Comments (3)
I'll take a look tomorrow.
from googler.
By the way, I'm thinking about adding some dev scripts to facilitate development. Current idea:
> tree devbin
devbin
├── __pycache__
│ └── googler.cpython-35.pyc
├── googler.py -> ../googler
└── parse
1 directory, 3 files
Content of parse
:
#!/usr/bin/env python3
import argparse
import json
import googler
def main():
argparser = argparse.ArgumentParser(description='Parse Google responses.')
argparser.add_argument('-N', '--news', action='store_true',
help='parse as Google News responses')
argparser.add_argument('files', nargs='+', metavar='FILE',
help="HTML file with Google's response body")
args = argparser.parse_args()
for fn in args.files:
with open(fn, encoding='utf-8') as fp:
htmlparser = googler.GoogleParser(news=args.news)
htmlparser.feed(fp.read())
results_object = [r.jsonizable_object() for r in htmlparser.results]
print(json.dumps(results_object, indent=2, sort_keys=True, ensure_ascii=False))
if __name__ == '__main__':
main()
Invocation:
> devbin/parse -h
usage: parse [-h] [-N] FILE [FILE ...]
Parse Google responses.
positional arguments:
FILE HTML file with Google's response body
optional arguments:
-h, --help show this help message and exit
-N, --news parse as Google News responses
> devbin/parse /Volumes/ramdisk/googler-response-2qmy246b # Good
[
{
"abstract": "HELLO! Online brings you the latest celebrity & royal news from the UK & around the world, magazine exclusives, celeb babies, weddings, pregnancies and ...",
"title": "HELLO! Online: celebrity & royal news, magazine, babies, weddings ...",
"url": "http://www.hellomagazine.com/"
},
{
"abstract": "Hello, it's me. I was wondering if after all these years you'd like to meet. To go over everything. They say that time's supposed to heal ya. But I ain't done much ...",
"title": "ADELE LYRICS - Hello - A-Z Lyrics",
"url": "http://www.azlyrics.com/lyrics/adele/hello.html"
},
{
"abstract": "hello connects you with people and content around your passions. Show the world who you are, express what you love, and create meaningful connections.",
"title": "hello network",
"url": "http://www.hello.com/"
},
{
"abstract": "\"Hello\" is a song by English singer Adele. It was released on 23 October 2015 by XL Recordings as the lead single from her third studio album, 25 (2015). Adele ...",
"title": "Hello (Adele song) - Wikipedia, the free encyclopedia",
"url": "https://en.wikipedia.org/wiki/Hello_(Adele_song)"
},
{
"abstract": "Watch Hello by Adele online at vevo.com. Discover the latest music videos by Adele on Vevo.",
"title": "Hello - Adele - Vevo",
"url": "http://www.vevo.com/watch/adele/Hello/GBH481500074"
},
{
"abstract": "Make your phone smarter with Hello. Built by Messenger just for Android, Hello combines info from Facebook with the contact info on your phone so it's easy to ...",
"title": "Hello — Caller ID & Blocking - Android Apps on Google Play",
"url": "https://play.google.com/store/apps/details?id=com.facebook.phone&hl=en"
},
{
"abstract": "HELLO! 1779396 likes · 92804 talking about this. The official Facebook page for HELLO! magazine & http://www.hellomagazine.com/ FOLLOW US @...",
"title": "HELLO! - Facebook",
"url": "https://www.facebook.com/hello/"
},
{
"abstract": "Listen to Hello in full in the Spotify app. Play on Spotify. ℗ 2015 XL Recordings Ltd., under exclusive license to Columbia Records, a Division of Sony Music ...",
"title": "Hello by Adele on Spotify",
"url": "https://open.spotify.com/album/1Eo1pg2D4beFgf3HFTJTMc"
}
]
> devbin/parse /Volumes/ramdisk/googler-response-unjwqp8g # Bad
[]
from googler.
👍
from googler.
Related Issues (20)
- Understanding packaging HOT 1
- 无法使用 HOT 1
- Googler doesn't use default browser HOT 1
- New Design for Google News HOT 9
- reCAPTCHA-solving to use the service HOT 2
- Can't see sitelinks? HOT 1
- DeprecationWarning: ssl.PROTOCOL_TLS is deprecated HOT 2
- How do I pipe the output? > HOT 1
- Search by filetype HOT 2
- How do I exclude specific keywords? HOT 1
- ssl.PROTOCOL_TLS is deprecated warning HOT 4
- No Results. HOT 4
- Video-specific search not working
- exception TrackedTextwrap: the impossible happened at offset nn of text "" HOT 2
- how we can include ads HOT 1
- Recent error message HOT 1
- googler skipping first result for some searchs HOT 3
- No results for domain search (when the site: keyword/-d switch in use) HOT 1
- Results site youtube.com (results order)
- Showing none or just a single result
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 googler.