Comments (6)
Hello! What is the error that requires the use of a proxy?
Unfortunately using proxies isn't a feature that is supported out of the box but you can probably brew up your own solution using requests
builtin proxy support. instascrape
can scrape data from HTML so you can use requests
(with your needed proxies) to request data and then pass the response's HTML into an instascrape
scraper to scrape the data.
from instascrape.
Yes, the point is to prepare "something" that you can add to request
. I did it in other projects but the problem within instascrape
is that I don't know how to acccess request
to set my proxy credentials.
from instascrape.
@chris-greening Got some code working to scrape and validate proxies, but am not really sure how your library works. Willing to collaborate on this?
from instascrape.
@dtrillo We had to solve this problem as well. What I ended up doing was subclassing the Session
object to pass in to Profile.scrape
:
class Session(requests.Session):
"""Custom session subclass that allows passing through a timeout to requests.get"""
def __init__(self, timeout=None, proxies=None):
super().__init__()
self.timeout = timeout
self.proxies = proxies
def get(self, url, **kwargs):
kwargs.setdefault('allow_redirects', True)
return self.request('GET', url, **kwargs, timeout=self.timeout, proxies=self.proxies)
and then using it this way:
with Session(timeout=20, proxies=self.proxies) as s:
profile.scrape(session=s)
from instascrape.
The above is only necessary for us for authenticated proxies if you want to keep trust_env = True
for the Session. Otherwise you can just create a session and add proxies to that without the need for the subclassing
from instascrape.
@chris-greening . I am trying to use proxies with InstaScrape to avoid blocking. I tried the solution of @nickhendo but can't get it to work. Any ideas?
from instascrape.
Related Issues (20)
- instascrape.exceptions.exceptions.InstagramLoginRedirectError: Instagram is redirecting you to the login page instead of the page you are trying to scrape. This could be occuring because you made too many requests too quickly or are not logged into Instagram on your machine. Try passing a valid session ID to the scrape method as a cookie to bypass the login requirement HOT 2
- Even after passing a valid cookie, the Instagram account gets disabled (update: permanently) HOT 2
- no of profiles during a day HOT 1
- Cannot retreive video_url from post object HOT 1
- Unable to locate file with data dump from posts
- TypeError: 'NoneType' object is not subscriptable on location scrape
- Biography field brings own bio
- Error : 'Post' object has no attribute 'video_url' HOT 1
- requests lib throwing `Invalid value NaN (not a number)` Error HOT 1
- ValueError while Scrapping Posts HOT 9
- KeyError: 'ProfilePage'
- Getting an Error while I call method "scrape" HOT 2
- ValueError: Invalid value NaN (not a number)
- JSONDecodeError within scrape() method HOT 6
- I want to grab the recent reels video views from the profile page (username/reels/)? Is that possible?
- TypeError:Profile.__init__() missing 1 required positional argument: data
- json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) HOT 3
- Error scraping photos: ModuleNotFoundError: No module named 'helpers' HOT 2
- its gives an error when i try to download the reel HOT 1
- MissingCookiesWarning: Request header does not contain cookies! It's recommended you pass at least a valid sessionid otherwise Instagram will likely redirect you to their login page.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instascrape.