pauloromeira / onegram Goto Github PK
View Code? Open in Web Editor NEWThis repository is no longer maintained.
License: MIT License
This repository is no longer maintained.
License: MIT License
Hi Paulo,
is there a way to search posts by tag?
I'm just trying to fidn some post with a specific tag and I get this error:
Traceback (most recent call last):
File "bot.py", line 34, in
for p in explore(tag=TAG):
File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/sessionlib/sessionlib.py", line 132, in _handle_generator
for item in response:
File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/onegram/queries.py", line 54, in explore
yield from explore_tag(session, tag)
File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/sessionlib/sessionlib.py", line 132, in _handle_generator
for item in response:
File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/onegram/queries.py", line 61, in explore_tag
yield from _iter_query(session, variables)
File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/onegram/queries.py", line 124, in _iter_query
_iter_progress(session, data, progress)
File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/onegram/queries.py", line 142, in _iter_progress
total = progress.setdefault('total', data.get('count', 0))
AttributeError: 'NoneType' object has no attribute 'get'
Hi, I'm trying to use user_info, but I'm getting this error:
`In [20]: from onegram import user_info
CookieConflictError Traceback (most recent call last)
in ()
----> 1 user_info("chiaraferragni")
~/project/instabot/lib/python3.6/site-packages/sessionlib/sessionlib.py in wrapped(*args, **kwargs)
155 try:
156 if session is current_session:
--> 157 response = func(*args, **kwargs)
158 else:
159 with session:
~/project/instabot/lib/python3.6/site-packages/onegram/queries.py in user_info(session, username)
12 if session.unlogged and not username:
13 raise NotSupportedError('You must provide an user at Unlogged state')
---> 14 return _info(session, username=username or session.username)
15
16 @sessionaware
~/project/instabot/lib/python3.6/site-packages/onegram/queries.py in _info(session, **kw)
98 url = URLSquery
99 params = {'__a': '1'}
--> 100 response = session.query(url, params=params)
101 return jsearch(JSPATHS[query], response)
102
~/project/instabot/lib/python3.6/site-packages/onegram/session.py in query(self, url, *a, **kw)
98 signature = self._build_signature(url, kw.get('params'))
99 headers['X-Instagram-GIS'] = signature
--> 100 return self.request('GET', url, *a, **kw)
101
102
~/project/instabot/lib/python3.6/site-packages/onegram/session.py in request(self, method, url, *a, **kw)
124 return validate_response(self, response)
125
--> 126 return _request()
127
128
~/project/instabot/lib/python3.6/site-packages/tenacity/init.py in wrapped_f(*args, **kw)
237 @six.wraps(f)
238 def wrapped_f(*args, **kw):
--> 239 return self.call(f, *args, **kw)
240
241 def retry_with(*args, **kwargs):
~/project/instabot/lib/python3.6/site-packages/tenacity/init.py in call(self, fn, *args, **kwargs)
324 while True:
325 do = self.iter(result=result, exc_info=exc_info,
--> 326 start_time=start_time)
327 if isinstance(do, DoAttempt):
328 try:
~/project/instabot/lib/python3.6/site-packages/tenacity/init.py in iter(self, result, exc_info, start_time)
275
276 if not retry:
--> 277 return fut.result()
278
279 if self.after is not None:
/usr/lib/python3.6/concurrent/futures/_base.py in result(self, timeout)
423 raise CancelledError()
424 elif self._state == FINISHED:
--> 425 return self.__get_result()
426
427 self._condition.wait(timeout)
/usr/lib/python3.6/concurrent/futures/_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
--> 384 raise self._exception
385 else:
386 return self._result
~/project/instabot/lib/python3.6/site-packages/tenacity/init.py in call(self, fn, *args, **kwargs)
327 if isinstance(do, DoAttempt):
328 try:
--> 329 result = fn(*args, **kwargs)
330 continue
331 except BaseException:
~/project/instabot/lib/python3.6/site-packages/onegram/session.py in _request()
121 self.logger.info(f'{method} "{url}"')
122 response = self._requests.request(method, url, *a, **kw)
--> 123 self._update_csrftoken(response)
124 return validate_response(self, response)
125
~/project/instabot/lib/python3.6/site-packages/onegram/session.py in _update_csrftoken(self, response)
143
144 def _update_csrftoken(self, response=None):
--> 145 csrftoken = self.cookies.get('csrftoken', None)
146 if not csrftoken and response:
147 match = REGEXES['csrftoken'].search(response.text)
~/project/instabot/lib/python3.6/site-packages/requests/cookies.py in get(self, name, default, domain, path)
196 """
197 try:
--> 198 return self._find_no_duplicates(name, domain, path)
199 except KeyError:
200 return default
~/project/instabot/lib/python3.6/site-packages/requests/cookies.py in _find_no_duplicates(self, name, domain, path)
393 if path is None or cookie.path == path:
394 if toReturn is not None: # if there are multiple cookies that meet passed in criteria
--> 395 raise CookieConflictError('There are multiple cookies with name, %r' % (name))
396 toReturn = cookie.value # we will eventually return this as long as no cookie conflict
397
CookieConflictError: There are multiple cookies with name, 'csrftoken'`
Hello dev nice work, is it possible to like and follow likers of a. Particular page
Amigo,
Existe uma linha de código que faça deixar de seguir quem não me segue?
Abrassss
Hi,
if I tried to login, I got this error:
Traceback (most recent call last): File "main.py", line 33, in <module> for p in explore(tag='bacchereto'): File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/sessionlib/sessionlib.py", line 144, in wrapped current_session = cls.current() File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/onegram/session.py", line 31, in current return Session.current() or login() File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/onegram/session.py", line 221, in login return Login(*args, **kwargs).open() File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/sessionlib/sessionlib.py", line 92, in open context = enter_contexts.send(context_obj) File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/onegram/session.py", line 168, in enter_contexts self._login() File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/onegram/session.py", line 185, in _login headers['X-CSRFToken'] = self.cookies['csrftoken'] File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/requests/cookies.py", line 329, in __getitem__ return self._find_no_duplicates(name) File "/home/lorenzo/project/instabot/lib/python3.6/site-packages/requests/cookies.py", line 400, in _find_no_duplicates raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path)) KeyError: "name='csrftoken', domain=None, path=None"
Hi, is there a way to explore by place or by latitude/longitude/radius?
for flw in onegram.followers():
print(flw['username'])
will return
INFO:sessionlib.sessionlib: (xxxxxx) session opened
INFO:onegram.session:(xxxxxx) queries.followers: GET "https://www.instagram.com/graphql/query/"
INFO:onegram.session:(xxxxxx) queries.followers: FETCH 16 :: [16/38] - 42%
---
---
---
INFO:onegram.session:(xxxxxx) queries.followers: WAIT queries 0.88s ...
INFO:onegram.session:(xxxxxx) queries.followers: GET "https://www.instagram.com/graphql/query/"
INFO:onegram.session:(xxxxxx) queries.followers: FETCH 1 :: [17/38] - 45%
---
INFO:onegram.session:(xxxxxx) queries.followers: WAIT queries 0.92s ...
INFO:onegram.session:(xxxxxx) queries.followers: GET "https://www.instagram.com/graphql/query/"
WARNING:onegram.session:(xxxxxx) queries.followers: STOP :: No followers available
hi, it was using last week and it was working perfectly, but now it is giving error to log in and the instagram account is detecting activity and questioning the authorship.
Right now I have to comment that line, otherwise the script will stop very often, how can I properly trap this, validate_response is called in many places
onegram/onegram/utils/validation.py
Line 11 in 8294e23
def validate_response(session, response, auth=False):
try:
try:
js_response = json.loads(response.text)
except:
#response.raise_for_status()
if auth:
raise AuthFailed('Authentication failed')
else:
if auth:
https://www.instagram.com/audrey/
INFO:onegram.session:(xxxxxx) queries.user_info: GET "https://www.instagram.com/audrey/"
Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\sessionlib-0.2.1-py3.6.egg\sessionlib\sessionlib.py", line 157, in wrapped
response = func(*args, **kwargs)
File "D:\Codez\onegram\onegram\actions.py", line 8, in follow
return _user_action(session, user)
File "D:\Codez\onegram\onegram\actions.py", line 52, in _user_action
user_id = _user_id(session, user)
File "D:\Codez\onegram\onegram\queries.py", line 84, in _user_id
return user_info(session, user)['id']
File "C:\Program Files (x86)\Python36-32\lib\site-packages\sessionlib-0.2.1-py3.6.egg\sessionlib\sessionlib.py", line 157, in wrapped
response = func(*args, **kwargs)
File "D:\Codez\onegram\onegram\queries.py", line 14, in user_info
return _info(session, username=username or session.username)
File "D:\Codez\onegram\onegram\queries.py", line 101, in _info
return jsearch(JSPATHS[query], response)
File "D:\Codez\onegram\onegram\utils\__init__.py", line 22, in jsearch
raise TypeError()
TypeError
Please can you show me an example on how to use queries or a documentation quite confusing
,,,
user_info
followers
following
posts
post_info
likes
comments
feed
explore
,,,
and for some reason action.likes dont work for me .
login(username='xxxxxxx', password='xxxxxxx') for liker in likes('BhT6gpHFwMj'): like(liker)
thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.