Guest User

Untitled

a guest
Jan 31st, 2022
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import json
  2. import requests
  3.  
  4. url = "https://2ch.hk/b/res/262396698.json"
  5.  
  6. thread_content = requests.get(url)
  7. json_data = json.loads(thread_content.text)
  8.  
  9. for thread in json_data['threads']:
  10.     for post in thread['posts']:
  11.         for file in post['files']:
  12.             file_name = file['name']
  13.             full_url = "https://2ch.hk/" + file['path']
  14.             r = requests.get(full_url, allow_redirects=False)
  15.             open(file_name, 'wb').write(r.content)
Add Comment
Please, Sign In to add comment