@pieromqwerty/

AutoGram

Python

No description

fork
loading
Files
  • main.py
  • 00000001.jpg
  • data.json
  • requirements.txt
  • tags.txt

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.18543141707894617","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IGpzb24KaW1wb3J0IHJlcXVlc3RzCmZyb20gSW5zdGFncmFtQVBJIGltcG9ydCBJbnN0YWdyYW1BUEkKaW1wb3J0IG9zCgoKI2hlYWRlcnMgZm9yIGltYWdlIGNvbnRlbnQgcmVxdWVzdApoZWFkZXJzID0gewogICAgJ2F1dGhvcml0eSc6ICd3d3cuaW5zdGFncmFtLmNvbScsCiAgICAnY2FjaGUtY29udHJvbCc6ICdtYXgtYWdlPTAnLAogICAgJ3VwZ3JhZGUtaW5zZWN1cmUtcmVxdWVzdHMnOiAnMScsCiAgICAndXNlci1hZ2VudCc6ICdNb3ppbGxhLzUuMCAoV2luZG93cyBOVCAxMC4wOyBXaW42NDsgeDY0KSBBcHBsZVdlYktpdC81MzcuMzYgKEtIVE1MLCBsaWtlIEdlY2tvKSBDaHJvbWUvNzcuMC4zODY1LjEwIFNhZmFyaS81MzcuMzYgRWRnLzc3LjAuMjM1LjUnLAogICAgJ3NlYy1mZXRjaC1tb2RlJzogJ25hdmlnYXRlJywKICAgICdzZWMtZmV0Y2gtdXNlcic6ICc/MScsCiAgICAnYWNjZXB0JzogJ3RleHQvaHRtbCxhcHBsaWNhdGlvbi94aHRtbCt4bWwsYXBwbGljYXRpb24veG1sO3E9MC45LGltYWdlL3dlYnAsaW1hZ2UvYXBuZywqLyo7cT0wLjgsYXBwbGljYXRpb24vc2lnbmVkLWV4Y2hhbmdlO3Y9YjMnLAogICAgJ3NlYy1mZXRjaC1zaXRlJzogJ25vbmUnLAogICAgJ2FjY2VwdC1lbmNvZGluZyc6ICdnemlwLCBkZWZsYXRlLCBicicsCiAgICAnYWNjZXB0LWxhbmd1YWdlJzogJ2VuLVVT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hdGggPSAnMDAwMDAwMDEuanBnJwpjYXB0aW9uID0gZi5yZWFkKCkKSW5zdGFncmFtQVBJLnVwbG9hZFBob3RvKHBob3RvX3BhdGgsIGNhcHRpb249Y2FwdGlvbik="},"asBuffer":null},"loaded":true}}
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
import json
import requests
from InstagramAPI import InstagramAPI
import os


#headers for image content request
headers = {
    'authority': 'www.instagram.com',
    'cache-control': 'max-age=0',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.10 Safari/537.36 Edg/77.0.235.5',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-user': '?1',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
    'sec-fetch-site': 'none',
    'accept-encoding': 'gzip, deflate, br',
    'accept-language': 'en-US,en;q=0.9',
}

params = (
    ('__a', '1'),
)

#getting image content
response = requests.get('https://www.instagram.com/explore/tags/dankmemes/', headers=headers, params=params)
responseModern = response.content
content = responseModern.decode('utf-8')
j = json.loads(content)

#parsing out image location
graphql = j['graphql']
hashtag = graphql['hashtag']
edge_hashtag_to_media = hashtag['edge_hashtag_to_media']
edges = edge_hashtag_to_media['edges']
lenode = edges[1]
node = lenode['node']
img_link = node['display_url']
print(img_link)

#getting image from url
f = open('00000001.jpg','wb')
f.write(requests.get(img_link).content)
f.close()

#logging in
InstagramAPI = InstagramAPI('duck.mems', 'Qazwaz123')
InstagramAPI.login()

#opening tags file and uploading to instagram
f = open("tags.txt", "r")
photo_path = '00000001.jpg'
caption = f.read()
InstagramAPI.uploadPhoto(photo_path, caption=caption)