Flower in my dev/Python

<PYTHON>[pygoogle]

꽃선생 2015. 9. 9. 16:42

[pygoogle]


- 구글 검색 결과를 돌려주는 모듈


- 설치 : svn으로 소스 다운로드


svn checkout http://pygoogle.googlecode.com/svn/trunk/ pygoogle


- 라이브러리 등록


python setup.py build

sudo python setup.py instals



- 실행 결과



- ipython 테스트 결과

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
In [1]: from pygoogle import pygoogle
 
In [2]: r = pygoogle('flowerinmyheart')
 
In [3]: r
Out[3]: <pygoogle.pygoogle instance at 0x106641ab8>
 
In [4]: r.
r.display_results   r.get_urls          r.pages             r.safe
r.filter            r.hl                r.query             r.search
r.get_result_count  r.logger            r.rsz               r.search_page_wise
 
In [4]: r.display_results()
[Random feature 1 by FlowerInMyHeart on DeviantArt]
Mar 262015 ... Here is some nice photography,some nice traditional drawings/paintings,some
nice digital drawings/paintings,some nice fractal art and some
http://flowerinmyheart.deviantart.com/journal/Random-feature-1-522719645
 
###===생략
 
[ohnios (Ekaraj Ohnios Wsp) - DeviantArt]
ohnios submitted a deviation. Yunyoung by ohnios. Yunyoung. I still remember..
the flower in my heart. #watercolor #beautiful #girl #korean. Loading... View All
http://ohnios.deviantart.com/
 
pygoogle ERROR __search__| responseDetails : out of range start
pygoogle ERROR __search__| responseDetails : out of range start
 
In [5]: r.get_result_count()
Out[5]: u'1990'
 
In [6]: r.pages = 1
 
In [7]: r.search()
Out[7]:
{u'Free The flower in my heart!_570 Wallpaper Download': u'http://www.wallpaperhere.com/The_flower_in_my_heart_570',
 u'HelloNano Proton | Facebook': u'https://www.facebook.com/flowerinmyheart',
 u'M-Wave Taesabiae(\ud0dc\uc0ac\ube44\uc560) _ Like a Flower in My Heart(\uac00\uc2b4\uc18d\uc5d0 ...': u'http://www.youtube.com/watch?v=u99mrzehXus',
 u'More Collections Like Random feature 1 by FlowerInMyHeart': u'http://www.deviantart.com/morelikethis/collections/522719645',
 u'Random feature 1 by FlowerInMyHeart on DeviantArt': u'http://flowerinmyheart.deviantart.com/journal/Random-feature-1-522719645',
 u'You are flower in my heart&#39;s garden - DesiFBCovers.com': u'http://www.desifbcovers.com/love-facebook-covers/you-are-flower-in-my-hearts-garden/',
 u'[MB] 100528 \ud0dc\uc0ac\ube44\uc560 (Taesabiae) - \uac00\uc2b4\uc18d\uc5d0 \ud540 \uaf43\ucc98\ub7fc (Like A ...': u'http://www.youtube.com/watch?v=Q-SG0obNK2w',
 u'\u79d1\u5b66\u7f51\u2014Flowers that Flower in My Heart - \u65bd\u6dfb\u9526\u7684\u535a\u6587 - \u79d1\u5b66\u7f51\u2014\u535a\u5ba2': u'http://blog.sciencenet.cn/blog-1294056-837831.html'}
 
In [8]: .get_urls()
  File "<ipython-input-8-c419a9fb861d>", line 1
    .get_urls()
    ^
SyntaxError: invalid syntax
 
 
In [9]: r.get_urls()
Out[9]:
[u'http://flowerinmyheart.deviantart.com/journal/Random-feature-1-522719645',
 u'http://www.deviantart.com/morelikethis/collections/522719645',
 u'http://www.youtube.com/watch?v=u99mrzehXus',
 u'http://www.youtube.com/watch?v=Q-SG0obNK2w',
 u'http://blog.sciencenet.cn/blog-1294056-837831.html',
 u'http://www.desifbcovers.com/love-facebook-covers/you-are-flower-in-my-hearts-garden/',
 u'http://www.wallpaperhere.com/The_flower_in_my_heart_570',
 u'https://www.facebook.com/flowerinmyheart']
cs