Comments (6)
Thank you so much @cajuncooks for taking the time to investigate and find a workaround.
I've implemented your fix as described and published the version 0.2.6 for all platforms! π
from dmarchiver.
Seeing this since last week:
DMArchiver 0.2.5
Running on Python 3.7.4 (default, Jul 9 2019, 18:14:44)
[Clang 9.0.0 (clang-900.0.39.2)]
Traceback (most recent call last):
File "dmarchiver/cmdline.py", line 134, in
File "dmarchiver/cmdline.py", line 97, in main
File "dmarchiver/core.py", line 312, in authenticate
IndexError: list index out of range
[1863] Failed to execute script cmdline
Using macOS 10.15.3
from dmarchiver.
Same. Itβs not just Mac though. I get the same on Linux. Twitter may have changed something.
from dmarchiver.
Same on Windows 10, I hope we'll get a fix of this :(
from dmarchiver.
This fixed it for me. Twitter now shows a splash that asks if you want to be taken to legacy Twitter if your scraper doesn't have JS enabled. We could either run a headless Selenium webdriver (huge headache), or do this. It's not the cleanest solution, but it works, and the session saving still works, so... shrug emoji. I can open a pull, but I imagine @Mincka may want to refactor this a bit instead.
In core.py
, under class Crawler(object):
add _login_headers
beneath _http_headers
:
_http_headers = {
'User-Agent': _user_agent}
_login_headers = {
'User-Agent': _user_agent,
'Referer': 'https://mobile.twitter.com/login'}
add force_nojs
at the start of def authenticate
:
def authenticate(self, username, password, save_session, raw_output):
force_nojs = 'https://mobile.twitter.com/i/nojs_router?path=%2Flogin'
login_url = self._twitter_base_url + '/login'
and this this is the meat of the changes, just a bit further down:
response = self._session.post(
force_nojs,
headers=self._login_headers)
[...]
document = lxml.html.document_fromstring(response.content)
Sending that post request (instead of a get, as before) to the nojs redirect is enough to get what lxml needs to parse. For whatever reason, lxml.html needs response.content instead of response.text, now, too.
I only noticed this issue because I had to change my password overnight so all of my sessions were invalidated. Good reminder to use the session saving feature! (Which I tested to still work, and requires that _http_headers stays static, i.e. no referer in the header.)
from dmarchiver.
Unfortunately, this issue does not seem to be fixed on my side. No logs are created, just the same error, but on 0.2.6 instead
DMArchiver 0.2.6
Running on Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)]
Traceback (most recent call last):
File "dmarchiver\cmdline.py", line 134, in <module>
File "dmarchiver\cmdline.py", line 97, in main
File "dmarchiver\core.py", line 316, in authenticate
IndexError: list index out of range
Failed to execute script cmdline
Weirdly enough, it is running Python 3.4.4, while I only have 3.9.4 installed.
from dmarchiver.
Related Issues (20)
- add exception to attribute error HOT 5
- Windows detects Trojan:Win32/Ditertag.B HOT 2
- App closes when trying to use it + account suspension HOT 4
- -dv Videos won't download HOT 4
- Problems With LXML install on arch HOT 4
- Total newbie here. How do i run the $ commands?
- Kinda New. Just Need General Help?
- "Connection reset by peer" probably caused by legacy TLS HOT 4
- Add command to split in several files
- No longer working on Mac HOT 2
- Way to limit amount of dms pulled? HOT 1
- image link is empty HOT 3
- Request: Optional Timestamps
- Conversation id error HOT 3
- Support to get reactions to message HOT 8
- A nit in the README HOT 1
- DMArchiver is broken HOT 24
- Dependabot couldn't authenticate with https://pypi.python.org/simple/
- wrong repo
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 dmarchiver.