Skip to content

Instantly share code, notes, and snippets.

@dapao9999
Forked from pcmid/BaiduPCS-appid-getter.py
Created September 9, 2019 12:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dapao9999/ed61de26b01325ecc38d9790cfffd9f6 to your computer and use it in GitHub Desktop.
Save dapao9999/ed61de26b01325ecc38d9790cfffd9f6 to your computer and use it in GitHub Desktop.
获取有效的百度app_id
from __future__ import print_function
import requests
import threading
import sys
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
class GetterTread(threading.Thread):
def __init__(self, thread_id, app_id, times=1000):
threading.Thread.__init__(self)
self.__thread_id = thread_id
self.__URL = "http://pcs.baidu.com/rest/2.0/pcs/file?app_id={}&method=list&path=%2F"
with open("./BDUSS.txt") as f:
BDUSS = f.readline()
self.__COOKIES = {"BDUSS": BDUSS}
self.app_id = app_id
self.times = times
def run(self):
current_id = self.app_id
while current_id - self.app_id < self.times: # 250000:
url = self.__URL.format(current_id)
try:
r = requests.get(url, cookies=self.__COOKIES)
if r.status_code == 200:
print(current_id)
except Exception:
eprint("Exception: " + str(current_id))
current_id += 1
# print("id " + str(self.__thread_id) + " over")
if __name__ == '__main__':
start_app_id = 300000
times = 1000
threads_list = []
while start_app_id < 500000:
thread = GetterTread(start_app_id, start_app_id, times)
thread.start()
threads_list.append(thread)
start_app_id += times
# print("size: " + str(len(threads_list)))
for thread in threads_list:
thread.join()
371067
419237
323309
312618
310646
309847
421937
@landall
Copy link

landall commented Sep 23, 2019

371067 已经403了。

我刚才测了一下非全局的那些appid,发现有的appid居然可以upload,不支持download。不知道未来是否需要更多分支的测试。以及。。。gist居然解禁了!!!

@landall
Copy link

landall commented Sep 23, 2019

download api的情况:
419237 失败
323309 失败
312618 失败
310646 失败
309847 失败
421937 失败

266719是成功的,所以测试程序应该是可靠的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment