Comments (4)
Same here, i need to mining in non-english text also, please help us.
Thanks!
from twitterscraper.
alternative solution is use location of the non-english city.
from twitterscraper.
You can write a script in your Python intepreter like following :
from twitterscraper import query_tweets
for tweet in query_tweets('your keyword', 10)[:10]:
text = tweet.text.encode('utf-8')
user = tweet.user.encode('utf-8')
xfile = 'F:/tweets.txt' #you can create your own .json in your own path
with open(xfile, 'ab+') as f: #ab+ is to write in the end position of the file (appending)
f.seek(0)
f.write(text+'\n') #you need '\n' to make new line for incoming tweets
f.write(user+'\n')
Hope it helps.
from twitterscraper.
@zdw-chj @ralfian @aliyudin21
The twitterscraper as it is, should work properly with non-english characters.
The thing is, when the text is saved to file, it is saved as the utf-8 encoded bytes of these characters instead of the actual characters.
So when you scrape for "戦う", the contents of the file will indeed look something like ""\u30b1\u30f3\u3055\u307e\u30fe ..."
so what you should do is open this file with the proper encoding
import codecs, json
filename = 'chinese.json'
with codecs.open(filename, 'r', 'utf-8') as f:
tweets = json.load(f, encoding='utf-8')
See example below:
from twitterscraper.
Related Issues (20)
- Why Does Not Work? HOT 2
- OSError: [WinError 87] The parameter is incorrect HOT 1
- Scrapping using a limit
- Feature: Twitter Followings (and maybe Followers) HOT 1
- Documentation: Addressing shadow-bans
- from twitterscraper import query_tweets HOT 4
- No ouput from "query_tweets_from_user" HOT 7
- Retrying... no success.
- Problem parsing proxy list HOT 3
- How to get a all followers list of one twitter account ?
- Not working due to : AttributeError: 'NoneType' object has no attribute 'find_all' HOT 13
- twitter scrapper error HOT 7
- Is this project functional? HOT 1
- encoding issue in cp1252.py HOT 1
- query_tweet function throwing errors
- Not working at the first step of installation HOT 1
- Getting error with main code inside beatifulSoup HOT 5
- Getting error when getting a help and scrape data HOT 2
- return with "Got 0 tweets (0 new)" HOT 1
- AttributeError: 'NoneType' object has no attribute 'find_all' HOT 8
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 twitterscraper.