-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinks.py
73 lines (57 loc) · 2.15 KB
/
links.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import feedparser
import requests
import json
import curlify
feed = feedparser.parse("https://www.inoreader.com/stream/user/1005349717/tag/save")
links = []
for entry in feed.entries:
links.append(entry.link)
print(entry.link)
url = 'https://t0guvf0w17.execute-api.us-east-1.amazonaws.com/Prod/web'
headers = {
'authority': 't0guvf0w17.execute-api.us-east-1.amazonaws.com' ,
'accept': '*/*' ,
'accept-language': 'en-US,en;q=0.9' ,
'content-type': 'text/plain' ,
'dnt': '1' ,
'origin': 'https://zbib.org' ,
'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"' ,
'sec-ch-ua-mobile': '?0' ,
'sec-ch-ua-platform': '"macOS"' ,
'sec-fetch-dest': 'empty' ,
'sec-fetch-mode': 'cors' ,
'sec-fetch-site': 'cross-site' ,
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'
}
links = links[0]
outinfo = []
for link in links:
body = {'data-raw': link}
r = requests.post(url, data=body, headers=headers)
if r.status_code == 200 :
outinfo = outinfo + json.loads(r.content.decode("utf-8"))
print(curlify.to_curl(r.request))
print(outinfo)
with open('bibinfo.json', 'w') as out_file:
json.dump(outinfo, out_file, sort_keys = True, indent = 4,
ensure_ascii = False)
url2 = 'https://t0guvf0w17.execute-api.us-east-1.amazonaws.com/Prod/export?format=bibtex'
headers2 = {
'authority': 't0guvf0w17.execute-api.us-east-1.amazonaws.com' ,
'accept': '*/*' ,
'accept-language': 'en-US,en;q=0.9' ,
'content-type': 'application/json' ,
'dnt': '1' ,
'origin': 'https://zbib.org' ,
'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"' ,
'sec-ch-ua-mobile': '?0' ,
'sec-ch-ua-platform': '"macOS"' ,
'sec-fetch-dest': 'empty' ,
'sec-fetch-mode': 'cors' ,
'sec-fetch-site': 'cross-site' ,
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'
}
outinfo = str(outinfo).replace("'", '"')
body2 = {'data-raw': json.dumps(outinfo) }
r = requests.post(url2, data=body2, headers=headers2)
r.content