From 5afc6fe19f9d2487b11060dfebdc096782e97cc1 Mon Sep 17 00:00:00 2001 From: criseLYJ <1148995537@qq.com> Date: Fri, 22 Mar 2019 22:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E5=B0=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- guoke/guoke_spider.py | 1 + jd_login/login_by_selenium.py | 1 - liepin/liepin_login.py | 3 ++- sina/sina.py | 2 ++ 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/guoke/guoke_spider.py b/guoke/guoke_spider.py index cf31eb0..19233f1 100644 --- a/guoke/guoke_spider.py +++ b/guoke/guoke_spider.py @@ -74,6 +74,7 @@ def save_article(content): f.write('\n'.join([str(content.get('title')), str(content.get('autor')), str(content.get('article'))])) print('Downloaded article path is %s' % file_name) else: + file_name = str(content.get('title')) + '.txt' print('Already Downloaded', file_name) except requests.ConnectionError: print('Failed to Save Image,item %s' % content) diff --git a/jd_login/login_by_selenium.py b/jd_login/login_by_selenium.py index 8ccf796..54e8717 100755 --- a/jd_login/login_by_selenium.py +++ b/jd_login/login_by_selenium.py @@ -2,7 +2,6 @@ import time from selenium import webdriver -# 强东的系统登陆模块没有用iframe,定位也没有微博那么复杂,可以靠id定位登陆 login_url = 'https://passport.jd.com/new/login.aspx' driver = webdriver.PhantomJS() driver.get(login_url) diff --git a/liepin/liepin_login.py b/liepin/liepin_login.py index 630f744..1071ae7 100644 --- a/liepin/liepin_login.py +++ b/liepin/liepin_login.py @@ -4,6 +4,7 @@ Required - requests - bs4 ''' +import getpass import hashlib import requests from bs4 import BeautifulSoup @@ -71,6 +72,6 @@ class Leipin(object): if __name__ == '__main__': userName = input("请输入你的用户名:") - password = input("请输入你的密码:") + password = getpass.getpass("password:") lp = Leipin(userName, password) print(lp.login()) diff --git a/sina/sina.py b/sina/sina.py index 6d4f1c0..33da233 100644 --- a/sina/sina.py +++ b/sina/sina.py @@ -1,3 +1,5 @@ +import getpass + import requests import hashlib import time