Guest User

Untitled

a guest
Jun 26th, 2025
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. import requests
  2. import shutil
  3.  
  4. res = requests.get('https://2ch.hk/b/catalog.json')
  5.  
  6. catalog = res.json()
  7.  
  8. thread = max([t['num'] for t in catalog['threads'] if t['subject'].startswith('ЛЕГЕНДАРНЫЙ ТРЕД ZASMOBOS')])
  9.  
  10. res = requests.get(f'https://2ch.hk/api/mobile/v2/after/b/{thread}/{thread}')
  11.  
  12. posts = res.json()['posts']
  13.  
  14. posts = [p for p in posts if p['op'] == 1 or p['num'] == thread]
  15.  
  16. for post in posts:
  17.     files = post.get('files') or []
  18.     for file in files:
  19.         image_url = 'https://2ch.hk' + file['path']
  20.         save_path = 'C:/zasmobos/' + file['name']
  21.         res = requests.get(image_url, stream=True)
  22.         with open(save_path, 'wb') as out_file:
  23.             shutil.copyfileobj(res.raw, out_file)
Add Comment
Please, Sign In to add comment