instaloader / instaloader

Download pictures (or videos) along with their captions and other metadata from Instagram.

Home Page:https://instaloader.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

copy_session() not copy proxies

Zerosik opened this issue · comments

If you look at copy_session() in instalodercontext.py, it copies the cookies and headers, but does not copy the existing proxy along with them.
When you do something that copies the session
(in my case instaloader.Profile.from_username() )
the request will be sent through my IP

To fix this, I added the following line of code to copy_session() to fix it

new.proxies = session.proxies

So my question is, is there a reason why 'copy_session()' doesn't copy the proxy?
Or am I missing something in the instructions?

my code :

L = instaloader.Instaloader()
L.context._session.proxies = {
            'http': f'http://proxyip:port',
            'https': f'http://proxyip:port',
        }
try:
    profile = instaloader.Profile.from_username(L.context, 'ash.island')
except instaloader.exceptions.ConnectionException as e :
    print(e)
posts = profile.get_posts()

for idx, post in enumerate(posts):
    L.download_post(post, profile.full_name)
    if idx >= 500:
        break
    time.sleep(random.randint(1,7))
commented

I am using the scrapingbee proxy. It seems this method is not working for me. I got an SSL verification error. If I set the new.verify = False, it returns HTTP error code 500. I am new to this. Do you have any recommendations on how to resolve the issue?