Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import shutil
- res = requests.get('https://2ch.hk/b/catalog.json')
- catalog = res.json()
- thread = max([t['num'] for t in catalog['threads'] if t['subject'].startswith('ЛЕГЕНДАРНЫЙ ТРЕД ZASMOBOS')])
- res = requests.get(f'https://2ch.hk/api/mobile/v2/after/b/{thread}/{thread}')
- posts = res.json()['posts']
- posts = [p for p in posts if p['op'] == 1 or p['num'] == thread]
- for post in posts:
- files = post.get('files') or []
- for file in files:
- image_url = 'https://2ch.hk' + file['path']
- save_path = 'C:/zasmobos/' + file['name']
- res = requests.get(image_url, stream=True)
- with open(save_path, 'wb') as out_file:
- shutil.copyfileobj(res.raw, out_file)
Add Comment
Please, Sign In to add comment