Skip to content

Commit

Permalink
fix typo artilce to article fix #149
Browse files Browse the repository at this point in the history
  • Loading branch information
chyroc committed Oct 12, 2017
1 parent ad07cb0 commit 36190c4
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 47 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,16 @@ list of dict, dict:
}
```

### 解析最近文章页 - get_gzh_artilce_by_history
### 解析最近文章页 - get_gzh_article_by_history

![ws_api.search_article('南京航空航天大学')](https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_artilce_by_history.png)
![ws_api.search_article('南京航空航天大学')](https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_article_by_history.png)

- 使用
```
In [1]: import wechatsogou
...:
...: ws_api =wechatsogou.WechatSogouAPI()
...: ws_api.get_gzh_artilce_by_history('南航青年志愿者')
...: ws_api.get_gzh_article_by_history('南航青年志愿者')
...:
Out[1]:
{
Expand Down Expand Up @@ -315,17 +315,17 @@ Out[1]:

```

### 解析 首页热门 页 - get_gzh_artilce_by_hot
### 解析 首页热门 页 - get_gzh_article_by_hot

![ws_api.get_gzh_artilce_by_hot(WechatSogouConst.hot_index.food)](https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_artilce_by_hot.png)
![ws_api.get_gzh_article_by_hot(WechatSogouConst.hot_index.food)](https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_article_by_hot.png)

- 使用
```
In [1]: from pprint import pprint
...: from wechatsogou import WechatSogouAPI, WechatSogouConst
...:
...: ws_api = WechatSogouAPI()
...: gzh_articles = ws_api.get_gzh_artilce_by_hot(WechatSogouConst.hot_index.food)
...: gzh_articles = ws_api.get_gzh_article_by_hot(WechatSogouConst.hot_index.food)
...: for i in gzh_articles:
...: pprint(i)
...:
Expand Down
12 changes: 6 additions & 6 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ list of dict, dict:
}
}
解析最近文章页 - get\_gzh\_artilce\_by\_history
解析最近文章页 - get\_gzh\_article\_by\_history
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. figure:: https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_artilce_by_history.png
.. figure:: https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_article_by_history.png
:alt: ws\_api.search\_article('南京航空航天大学')

ws\_api.search\_article('南京航空航天大学')
Expand All @@ -273,7 +273,7 @@ list of dict, dict:
In [1]: import wechatsogou
...:
...: ws_api =wechatsogou.WechatSogouAPI()
...: ws_api.get_gzh_artilce_by_history('南航青年志愿者')
...: ws_api.get_gzh_article_by_history('南航青年志愿者')
...:
Out[1]:
{
Expand Down Expand Up @@ -333,16 +333,16 @@ list of dict, dict:
::


### 解析 首页热门 页 - get_gzh_artilce_by_hot
### 解析 首页热门 页 - get_gzh_article_by_hot

![ws_api.get_gzh_artilce_by_hot(WechatSogouConst.hot_index.food)](https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_artilce_by_hot.png)
![ws_api.get_gzh_article_by_hot(WechatSogouConst.hot_index.food)](https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_article_by_hot.png)

- 使用

In [1]: from pprint import pprint ...: from wechatsogou import
WechatSogouAPI, WechatSogouConst ...: ...: ws\_api = WechatSogouAPI()
...: gzh\_articles =
ws\_api.get\_gzh\_artilce\_by\_hot(WechatSogouConst.hot\_index.food)
ws\_api.get\_gzh\_article\_by\_hot(WechatSogouConst.hot\_index.food)
...: for i in gzh\_articles: ...: pprint(i) ...: { 'article': {
'abstract':
'闷热的夏天有什么事情能比吃上凉凉的甜品更惬意的呢?快一起动手做起来吧,简单方便,放冰箱冻一冻,那感觉~橙汁蒸木瓜木瓜1个(300-400克左右),橙子4个,枫糖浆20克(如果家里没有,也可以用蜂蜜、炼乳等代替),椰果适量。做法1.用削皮',
Expand Down
12 changes: 6 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,16 @@ list of dict, dict:
}
```

### 解析最近文章页 - get_gzh_artilce_by_history
### 解析最近文章页 - get_gzh_article_by_history

![ws_api.search_article('南京航空航天大学')](https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_artilce_by_history.png)
![ws_api.search_article('南京航空航天大学')](https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_article_by_history.png)

- 使用
```
In [1]: import wechatsogou
...:
...: ws_api =wechatsogou.WechatSogouAPI()
...: ws_api.get_gzh_artilce_by_history('南航青年志愿者')
...: ws_api.get_gzh_article_by_history('南航青年志愿者')
...:
Out[1]:
{
Expand Down Expand Up @@ -297,17 +297,17 @@ Out[1]:

```

### 解析 首页热门 页 - get_gzh_artilce_by_hot
### 解析 首页热门 页 - get_gzh_article_by_hot

![ws_api.get_gzh_artilce_by_hot(WechatSogouConst.hot_index.food)](https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_artilce_by_hot.png)
![ws_api.get_gzh_article_by_hot(WechatSogouConst.hot_index.food)](https://raw.githubusercontent.com/chyroc/wechatsogou/master/screenshot/get_gzh_article_by_hot.png)

- 使用
```
In [1]: from pprint import pprint
...: from wechatsogou import WechatSogouAPI, WechatSogouConst
...:
...: ws_api = WechatSogouAPI()
...: gzh_articles = ws_api.get_gzh_artilce_by_hot(WechatSogouConst.hot_index.food)
...: gzh_articles = ws_api.get_gzh_article_by_hot(WechatSogouConst.hot_index.food)
...: for i in gzh_articles:
...: pprint(i)
...:
Expand Down
File renamed without changes
File renamed without changes
26 changes: 13 additions & 13 deletions test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ def test_search_gzh_real(self):
assert_true(any(gaokao_keyword in i['wechat_name'] for i in gzh_list))
assert_true(any(i['open_id'] != '' for i in gzh_list))

def test_get_gzh_artilce_by_history_real(self):
gzh_artilce = ws_api.get_gzh_artilce_by_history(gaokao_keyword,
def test_get_gzh_article_by_history_real(self):
gzh_article = ws_api.get_gzh_article_by_history(gaokao_keyword,
identify_image_callback_sogou=self.identify_image_callback_sogou,
identify_image_callback_weixin=self.identify_image_callback_ruokuai_weixin)
assert_in('gzh', gzh_artilce)
assert_in('article', gzh_artilce)
assert_in('wx.qlogo.cn', gzh_artilce['gzh']['headimage'])
assert_greater_equal(len(gzh_artilce['article']), 1)
assert_in('gzh', gzh_article)
assert_in('article', gzh_article)
assert_in('wx.qlogo.cn', gzh_article['gzh']['headimage'])
assert_greater_equal(len(gzh_article['article']), 1)

def test_get_gzh_artilce_by_hot_real(self):
gzh_artilces = ws_api.get_gzh_artilce_by_hot(WechatSogouConst.hot_index.recommendation,
def test_get_gzh_article_by_hot_real(self):
gzh_articles = ws_api.get_gzh_article_by_hot(WechatSogouConst.hot_index.recommendation,
identify_image_callback=self.identify_image_callback_sogou)
for gzh_artilce in gzh_artilces:
assert_in('gzh', gzh_artilce)
assert_in('article', gzh_artilce)
assert_in('http://mp.weixin.qq.com/s?src=', gzh_artilce['article']['url'])
assert_greater_equal(len(gzh_artilces), 10)
for gzh_article in gzh_articles:
assert_in('gzh', gzh_article)
assert_in('article', gzh_article)
assert_in('http://mp.weixin.qq.com/s?src=', gzh_article['article']['url'])
assert_greater_equal(len(gzh_articles), 10)

def test_get_sugg(self):
sugg_gaokao = ws_api.get_sugg(gaokao_keyword)
Expand Down
24 changes: 12 additions & 12 deletions test/test_structuring.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,24 +249,24 @@ def test_get_gzh_info_and_article_by_history(self):
assert_in('gzh', gzh_article_list)
assert_in('article', gzh_article_list)

def test_get_gzh_artilce_by_hot(self):
def test_get_gzh_article_by_hot(self):
file_name = os.path.join(fake_data_path, 'wapindex-wap-0612-wap_8-0.html')
with io.open(file_name, encoding='utf-8') as f:
gzh_artilce_by_hot = f.read()
gzh_article_by_hot = f.read()

gzh_artilces = WechatSogouStructuring.get_gzh_artilce_by_hot(gzh_artilce_by_hot)
gzh_articles = WechatSogouStructuring.get_gzh_article_by_hot(gzh_article_by_hot)

for gzh_artilce in gzh_artilces:
assert_in('gzh', gzh_artilce)
assert_in('article', gzh_artilce)
assert_in('http://mp.weixin.qq.com/s?src=', gzh_artilce['article']['url'])
assert_greater_equal(len(gzh_artilces), 10)
for gzh_article in gzh_articles:
assert_in('gzh', gzh_article)
assert_in('article', gzh_article)
assert_in('http://mp.weixin.qq.com/s?src=', gzh_article['article']['url'])
assert_greater_equal(len(gzh_articles), 10)

wechat_names = []
headimages = []
titles = []
times = []
for i in gzh_artilces:
for i in gzh_articles:
wechat_names.append(i['gzh']['wechat_name'])
headimages.append(i['gzh']['headimage'])
titles.append(i['article']['title'])
Expand Down Expand Up @@ -316,15 +316,15 @@ def test_get_article_by_search_wap(self):
with io.open(file_name, encoding='utf-8') as f:
wap_json = json.load(f)

gzh_artilces = WechatSogouStructuring.get_article_by_search_wap(gaokao_keyword, wap_json)
assert_equal(10, len(gzh_artilces))
gzh_articles = WechatSogouStructuring.get_article_by_search_wap(gaokao_keyword, wap_json)
assert_equal(10, len(gzh_articles))

titles = []
abstracts = []
gzh_names = []
isvs = []
open_ids = []
for i in gzh_artilces:
for i in gzh_articles:
assert_in('gzh', i)
assert_in('article', i)

Expand Down
6 changes: 3 additions & 3 deletions wechatsogou/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def search_article(self, keyword, page=1, timesn=WechatSogouConst.search_article

return WechatSogouStructuring.get_article_by_search(resp.text)

def get_gzh_artilce_by_history(self, keyword=None, url=None,
def get_gzh_article_by_history(self, keyword=None, url=None,
unlock_callback_sogou=None,
identify_image_callback_sogou=None,
unlock_callback_weixin=None,
Expand Down Expand Up @@ -335,7 +335,7 @@ def get_gzh_artilce_by_history(self, keyword=None, url=None,

return WechatSogouStructuring.get_gzh_info_and_article_by_history(resp.text)

def get_gzh_artilce_by_hot(self, hot_index, page=1, unlock_callback=None, identify_image_callback=None):
def get_gzh_article_by_hot(self, hot_index, page=1, unlock_callback=None, identify_image_callback=None):
"""获取 首页热门文章
Parameters
Expand Down Expand Up @@ -374,7 +374,7 @@ def get_gzh_artilce_by_hot(self, hot_index, page=1, unlock_callback=None, identi
identify_image_callback=identify_image_callback)

resp.encoding = 'utf-8'
return WechatSogouStructuring.get_gzh_artilce_by_hot(resp.text)
return WechatSogouStructuring.get_gzh_article_by_hot(resp.text)

def get_article_content(self):
"""获取文章原文,避免临时链接失效
Expand Down
2 changes: 1 addition & 1 deletion wechatsogou/structuring.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def get_gzh_info_and_article_by_history(text):
}

@staticmethod
def get_gzh_artilce_by_hot(text):
def get_gzh_article_by_hot(text):
"""从 首页热门搜索 提取公众号信息 和 文章列表信息
Parameters
Expand Down

0 comments on commit 36190c4

Please sign in to comment.