Commit d3f53556 authored by 李康's avatar 李康

some improvement

parent 65af0d2a
...@@ -9,7 +9,7 @@ def cropImg(img, out, bounds): ...@@ -9,7 +9,7 @@ def cropImg(img, out, bounds):
cropped = img[int(bounds['top']):int(bounds['bottom']), int(bounds['left']):int(bounds['right'])] # 裁剪坐标为[y0:y1, x0:x1] cropped = img[int(bounds['top']):int(bounds['bottom']), int(bounds['left']):int(bounds['right'])] # 裁剪坐标为[y0:y1, x0:x1]
cv2.imwrite(out, cropped) cv2.imwrite(out, cropped)
def getBrandDetail(d, brand, done): def getBrandDetail(brand, done):
all_texts = brand.sibling(className="android.widget.TextView") all_texts = brand.sibling(className="android.widget.TextView")
name = all_texts[0].get_text() name = all_texts[0].get_text()
if name not in done: if name not in done:
...@@ -80,14 +80,50 @@ def getAllBrands(): ...@@ -80,14 +80,50 @@ def getAllBrands():
print(delim.join(res) + "\n") print(delim.join(res) + "\n")
getBrandImg(d, res[0]) getBrandImg(d, res[0])
# while True: f.flush()
# brand = d(className="android.support.v7.widget.RecyclerView").child(resourceId="org.c2h4.afei.beauty:id/tv_name_en")[0] f.close()
# res = getBrandDetail(d, brand, done)
# if res is not None:
# print(delim.join(res))
# f.writelines(delim.join(res))
# d.swipe_ext("down", scale=0.2)
def getEnglishBrands():
d = u2.connect_usb('d52196830204')
done = []
with open(brand_dir+"/brands.csv", "r") as f:
for line in f.readlines():
done.append(line.strip()[1].split("; "))
f = open(brand_dir+"/brands.csv", 'a+')
nocnt = 0
while True:
brand = None
brands = d(className="android.support.v7.widget.RecyclerView").child(resourceId="org.c2h4.afei.beauty:id/tv_name_en")
for temp in brands:
if temp.info['bounds']['top'] == temp.info['visibleBounds']['top']:
brand = temp
break
res = getBrandDetail(d, brand, done)
if res is not None:
print(delim.join(res))
f.write(delim.join(res) + "\n")
getBrandImg(d, res[0])
nocnt = 0
else:
nocnt += 1
if nocnt == 5:
break
d.swipe_ext("up", scale=0.2)
brands = d(className="android.support.v7.widget.RecyclerView").child(resourceId="org.c2h4.afei.beauty:id/tv_name")
for idx in range(1, brands.count):
res = getBrandDetail(d, brands[idx], done)
if res is not None:
f.writelines(delim.join(res))
print(delim.join(res) + "\n")
getBrandImg(d, res[0])
f.flush()
f.close()
if __name__=='__main__': if __name__=='__main__':
getAllBrands() getAllBrands()
getEnglishBrands()
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
标婷; 标婷; 中国内地; 由北京医院专家参与研制的护肤品品牌 标婷; 标婷; 中国内地; 由北京医院专家参与研制的护肤品品牌
宫灯; 宫灯; 中国内地 1962年成立; 国民老品牌,1962年第一款宫灯杏仁蜜问世,至今畅销 宫灯; 宫灯; 中国内地 1962年成立; 国民老品牌,1962年第一款宫灯杏仁蜜问世,至今畅销
东洋之花; Tayoi; 中国内地 1992年成立; 国产品牌,旗下护手霜系列最为经典 东洋之花; Tayoi; 中国内地 1992年成立; 国产品牌,旗下护手霜系列最为经典
精心; 精心; 中国内地 1992年成立; 经北京协和医院官方授权的护肤品品牌美宝莲; MAYBELLINE NEW YORK; 美国 1915年成立; 欧莱雅旗下的大众彩妆品牌,明星单品眼唇卸妆液性价比高 精心; 精心; 中国内地 1992年成立; 经北京协和医院官方授权的护肤品品牌
美宝莲; MAYBELLINE NEW YORK; 美国 1915年成立; 欧莱雅旗下的大众彩妆品牌,明星单品眼唇卸妆液性价比高
玛丽黛佳; MARIE DALGAR; 中国内地 2006年成立; 首个入驻丝芙兰的中国彩妆品牌,旗下彩妆产品种类齐全 玛丽黛佳; MARIE DALGAR; 中国内地 2006年成立; 首个入驻丝芙兰的中国彩妆品牌,旗下彩妆产品种类齐全
完美日记; perfectdiary; 中国内地 2016年成立; 近年来很火的新晋国货彩妆品牌 完美日记; perfectdiary; 中国内地 2016年成立; 近年来很火的新晋国货彩妆品牌
露华浓; Revlon; 美国 1932年成立; 知名彩妆品牌,最初靠指甲油起家 露华浓; Revlon; 美国 1932年成立; 知名彩妆品牌,最初靠指甲油起家
...@@ -199,7 +200,8 @@ ...@@ -199,7 +200,8 @@
艾诺碧; IOPE; 韩国 1996年成立; 爱茉莉太平洋旗下医学护肤品牌,以抗皱、美白等功效性产品为主打 艾诺碧; IOPE; 韩国 1996年成立; 爱茉莉太平洋旗下医学护肤品牌,以抗皱、美白等功效性产品为主打
赫妍; HERA; 韩国 1995年成立; 同属爱茉莉太平洋集团,气垫类产品最为火爆 赫妍; HERA; 韩国 1995年成立; 同属爱茉莉太平洋集团,气垫类产品最为火爆
爱敬; 爱敬; 韩国 1950年成立; 韩国第一日化品牌,在化妆品领域因“气垫粉霜”爆红 爱敬; 爱敬; 韩国 1950年成立; 韩国第一日化品牌,在化妆品领域因“气垫粉霜”爆红
九朵云; Cloud9; 韩国 1997年成立; 因“马油膏”为人所知的护肤品牌雅诗兰黛; Estee Lauder; 美国 1946年成立; 包含多个护肤系列,属于中高端畅销品牌的代表,其中白金系列走高奢路线 九朵云; Cloud9; 韩国 1997年成立; 因“马油膏”为人所知的护肤品牌
雅诗兰黛; Estee Lauder; 美国 1946年成立; 包含多个护肤系列,属于中高端畅销品牌的代表,其中白金系列走高奢路线
科颜氏; KIEHL'S; 美国 1851年成立; 来自于美国纽约,药剂师创立的护肤品品牌,后来被欧莱雅集团收购 科颜氏; KIEHL'S; 美国 1851年成立; 来自于美国纽约,药剂师创立的护肤品品牌,后来被欧莱雅集团收购
玉兰油; Olay; 美国 1952年成立; 发源于美国,最早进入中国市场的国际著名护肤品牌之一,属于宝洁集团 玉兰油; Olay; 美国 1952年成立; 发源于美国,最早进入中国市场的国际著名护肤品牌之一,属于宝洁集团
倩碧; CLINIQUE; 美国 1968年成立; 创立于美国纽约,现隶属于雅诗兰黛集团,其推广的基础护肤三步骤世界闻名 倩碧; CLINIQUE; 美国 1968年成立; 创立于美国纽约,现隶属于雅诗兰黛集团,其推广的基础护肤三步骤世界闻名
......
Catrice
CosMedix
HABA
HOLD LIVE
MILANI COSMETICS
Make Up Academy
NYX
OBAGI
Omorovicza
PHYSICIANS FORMULA
SK-II
Sesderma
The Ordinary
Timeless
Topix
VNK
W.LAB
e.l.f.
essence
kiko
make up revolution
乐敦
伊思
优佳
伯特
佳雪
依泉
倩丽
倩碧
兰芝
兰蔻
协和
博姿
双妹
启初
多芬
大宝
姬芮
娇兰
完美
宝丽
宫灯
得鲜
德妃
悠宜
新碧
旁氏
春娟
春雨
曼丹
朵梵
标婷
梦妆
森田
橘朵
洛克
爱敬
玉泽
珂润
碧柔
精心
纳斯
美即
羽西
肌研
至本
芮谜
芳珂
薇姿
蜜浓
谜尚
贝亲
赫妍
迪奥
银座
雅漾
雅邦
高夫
魅可
黛珂
苏秘37°
英国AA网
汤姆·福特
三熹玉
丝塔芙
丽得姿
九朵云
优色林
佑天兰
佰草集
佳丽宝
修丽可
凡士林
千纤草
博乐达
博倩叶
卡姿兰
卡尼尔
可复美
圣罗兰
奥碧虹
妙巴黎
妮维雅
娇韵诗
娥佩兰
孔凤春
孩儿面
安热沙
希思黎
思亲肤
怡思丁
悠珂思
敷尔佳
林清轩
植村秀
欧缇丽
欧舒丹
欧莱雅
欧诺颜
水宝宝
法儿曼
津尔氏
湿又野
火烈鸟
爱和纯
爱神菲
玉兰油
珀莱雅
理肤泉
百雀羚
科颜氏
稚优泉
纪梵希
美加净
美宝莲
肌美精
自然堂
艾惟诺
艾诺碧
芭妮兰
芯丝翠
苏菲娜
茵芙莎
莱珀妮
菊正宗
菲洛嘉
菲诗丽
蒂佳婷
薇诺娜
蜜丝婷
蜜葳特
蝶翠诗
诗佩妮
贝德玛
贝玲妃
资生堂
赛贝格
赫莲娜
达尔肤
适乐肤
郁美净
隆力奇
雅诗敦
雪肌精
雪花秀
霏丝佳
露华浓
露得清
香奈儿
香缇卡
馥蕾诗
上水和肌
东洋之花
伊蒂之屋
卡乐泡泡
卡奇色彩
名创优品
城野医生
完美日记
宝拉珍选
宠爱之名
彼得罗夫
德美乐嘉
怡丽丝尔
悦木之源
悦诗风吟
敏感话题
无印良品
曼秀雷敦
欧玛博士
海蓝之谜
牛乳石硷
玛丽黛佳
玛蒂德肤
相宜本草
美康粉黛
美迪惠尔
肌肤之钥
自然乐园
色彩日记
芙丽芳丝
芭比波朗
菲诗小铺
蜜丝佛陀
近江兄弟
雅诗兰黛
洛杉矶女孩
伊丽莎白雅顿
\ No newline at end of file
...@@ -318,22 +318,31 @@ def gotoSpecificProduct(d, productName): ...@@ -318,22 +318,31 @@ def gotoSpecificProduct(d, productName):
def getProductByType(argv): def getProductByType(argv):
brand_name = argv[1] brand_name = argv[1]
scraped_brands = []
with open("done.txt", "r") as f:
for line in f.readlines():
scraped_brands.append(line.strip())
if brand_name in scraped_brands:
print("Brand %s is already scraped!" % brand_name)
return
if not os.path.exists(brand_name): if not os.path.exists(brand_name):
os.makedirs(brand_name) os.makedirs(brand_name)
starting_brand_name = None starting_category_name = None
starting_product_name = None starting_product_name = None
if len(argv) == 3: if len(argv) == 3:
starting_brand_name = argv[2] starting_category_name = argv[2]
with open(brand_name + "/products.csv", 'r') as f: with open(brand_name + "/products.csv", 'r') as f:
temp = None temp = None
for line in f.readlines(): for line in f.readlines():
temp = line temp = line
last = temp.split("; ") last = temp.split("; ")
if last[0] != "": if last[-1].strip() == starting_category_name:
starting_product_name = last[0] if last[0] != "":
else: starting_product_name = last[0]
starting_product_name = last[1] else:
starting_product_name = last[1]
d = u2.connect_usb('d52196830204') d = u2.connect_usb('d52196830204')
print(d.app_current()) print(d.app_current())
...@@ -351,12 +360,12 @@ def getProductByType(argv): ...@@ -351,12 +360,12 @@ def getProductByType(argv):
temp_types = getAllFilterTypes(d) temp_types = getAllFilterTypes(d)
ftype_names = [] ftype_names = []
if starting_brand_name is not None: if starting_category_name is not None:
starting_flag = False starting_flag = False
for temp_type in temp_types: for temp_type in temp_types:
if starting_flag: if starting_flag:
ftype_names.append(temp_type) ftype_names.append(temp_type)
elif temp_type == starting_brand_name: elif temp_type == starting_category_name:
ftype_names.append(temp_type) ftype_names.append(temp_type)
starting_flag = True starting_flag = True
else: else:
......
#!/bin/sh
python product.py 百雀羚
python product.py 薇诺娜
python product.py 大宝
python product.py 自然堂
python product.py 相宜本草
python product.py 郁美净
python product.py 玉泽
python product.py 启初
python product.py 佰草集
python product.py 森田
python product.py 美加净
python product.py 至本
python product.py 美即
python product.py 达尔肤
python product.py 珀莱雅
python product.py 博乐达
python product.py 羽西
python product.py 宠爱之名
python product.py 协和
python product.py 上水和肌
python product.py 双妹
python product.py 完美
python product.py 隆力奇
python product.py 林清轩
python product.py 稚优泉
python product.py 高夫
\ No newline at end of file
#!/bin/sh
#python product.py 美宝莲
python product.py 玛丽黛佳
python product.py 完美日记
python product.py 露华浓
python product.py 妙巴黎
python product.py 橘朵
python product.py 蜜丝婷
python product.py 火烈鸟
python product.py 湿又野
python product.py 得鲜
python product.py 名创优品
python product.py 美康粉黛
python product.py 洛杉矶女孩
python product.py 卡姿兰
python product.py 卡乐泡泡
python product.py 雅邦
python product.py 倩丽
python product.py 稚优泉
python product.py 诗佩妮
python product.py 梦妆
python product.py 菲斯小铺
python product.py 卡奇色彩
python product.py 姬芮
python product.py 色彩日记
python product.py 悠珂思
python product.py 芮谜
python product.py PHYSICIANS\ FORMULA
python product.py MILANI\ COSMETICS
python product.py VNK
python product.py W.LAB
python product.py Make\ Up\ Academy
python product.py essence
python product.py make\ up\ revolution
python product.py e.l.f
python product.py kiko
python product.py HOLD\ LIVE
python product.py Catrice
python product.py NYX
#!/bin/sh
python product.py 启初
python product.py 碧柔
python product.py 美加净
python product.py 新碧
python product.py 凡士林
python product.py 丝塔芙
python product.py 妮维雅
python product.py 适乐肤
python product.py 博姿
python product.py 肌研
python product.py 多芬
python product.py 郁美净
python product.py 协和
python product.py 英国AA网
python product.py 贝亲
python product.py 自然乐园
python product.py 娥佩兰
python product.py 洛克
python product.py 近江兄弟
python product.py 至本
python product.py 卡尼尔
python product.py Timeless
python product.py 上水和肌
python product.py 菲诗丽
python product.py 菊正宗
python product.py 隆力奇
python product.py 千纤草
python product.py 乐敦
python product.py 佳雪
python product.py 孩儿面
python product.py 春娟
python product.py 牛乳石硷
python product.py 菲诗小铺
python product.py 孔凤春
python product.py 标婷
python product.py 宫灯
python product.py 东洋之花
python product.py 精心
#!/bin/sh
python product.py 修丽可
python product.py 理肤泉
python product.py 宝拉珍选
python product.py 薇姿
python product.py 优色林
python product.py 城野医生
python product.py 彼得罗夫
python product.py 菲洛嘉
python product.py 达尔肤
python product.py 怡思丁
python product.py 上水和肌
python product.py 赛贝格
python product.py 欧玛博士
python product.py 芯丝翠
python product.py Topix
python product.py Sesderma
python product.py OBAGI
python product.py 玛蒂德肤
python product.py 欧诺颜
python product.py 雅诗敦
python product.py CosMedix
python product.py The\ Ordinary
\ No newline at end of file
#!/bin/sh
python product.py 理肤泉
python product.py 珂润
python product.py 芙丽芳丝
python product.py 雅漾
python product.py 适乐肤
python product.py 薇诺娜
python product.py 霏丝佳
python product.py 芳珂
python product.py 玉泽
python product.py 依泉
python product.py 无印良品
python product.py 丝塔芙
python product.py 优色林
python product.py 启初
python product.py 优佳
python product.py 蜜浓
python product.py 至本
python product.py 敏感话题
python product.py 可复美
python product.py 敷尔佳
python product.py HABA
\ No newline at end of file
#!/bin/sh
python product.py 资生堂
python product.py 珂润
python product.py 城野医生
python product.py 肌肤之钥
python product.py 奥碧虹
python product.py 芙丽芳丝
python product.py 佳丽宝
python product.py 娥佩兰
python product.py 无印良品
python product.py 碧柔
python product.py 黛珂
python product.py 安热沙
python product.py 茵芙莎
python product.py 芳珂
python product.py 怡丽丝尔
python product.py 乐敦
python product.py 宝丽
python product.py 植村秀
python product.py 苏菲娜
python product.py 曼丹
python product.py 肌研
python product.py 雪肌精
python product.py 蝶翠诗
python product.py 姬芮
python product.py 佑天兰
python product.py 蜜浓
python product.py 肌美精
python product.py 近江兄弟
python product.py SK-II
python product.py HABA
\ No newline at end of file
#!/bin/sh
python product.py 妮维雅
python product.py 阿玛尼
python product.py 怡思丁
python product.py 英国AA网
python product.py 博姿
python product.py 玛蒂德肤
python product.py 优佳
python product.py 莱珀妮
python product.py 芭乐雅
python product.py 安娜柏林
python product.py 美体小铺
python product.py 贝佳斯
python product.py 伊芙兰
python product.py 霏丝佳
python product.py 优色林
python product.py 安多可
python product.py 法儿曼
python product.py ZELENS
python product.py Catrice
python product.py kiko
python product.py Sesderma
\ No newline at end of file
#!/bin/sh
python product.py 兰蔻
python product.py 欧莱雅
python product.py 理肤泉
python product.py 迪奥
python product.py 赫莲娜
python product.py 雅漾
python product.py 圣罗兰
python product.py 娇韵诗
python product.py 薇姿
python product.py 香奈儿
python product.py 贝德玛
python product.py 娇兰
python product.py 欧缇丽
python product.py 纪梵希
python product.py 欧舒丹
python product.py 依泉
python product.py 希思黎
python product.py 碧欧泉
python product.py 卡尼尔
python product.py 欧诺颜
python product.py 菲洛嘉
python product.py 赛贝格
python product.py 妙巴黎
python product.py 依云
python product.py 丝芙兰
python product.py 欧树
python product.py 朵梵
python product.py 蜜葳特
python product.py 香缇卡
\ No newline at end of file
#!/bin/sh
python product.py BEAUTY\ BUFFET
python product.py 蜜丝婷
python product.py 芮一
python product.py THANN
python product.py 安娜贝拉
python product.py SNAIL\ WHITE
python product.py ele
\ No newline at end of file
#!/bin/sh
python product.py 伊索
python product.py 茱莉蔻
python product.py 澳佳宝
python product.py 卢卡斯
python product.py 娜迪奥
python product.py 苏芊
python product.py Ego\ QV
python product.py Kosmea
python product.py Freeze\ Frame
python product.py Swisse
\ No newline at end of file
#!/bin/sh
python product.py 雅诗兰黛
python product.py 科颜氏
python product.py 玉兰油
python product.py 倩碧
python product.py 曼秀雷敦
python product.py 魅可
python product.py 旁氏
python product.py 修丽可
python product.py 海蓝之谜
python product.py 悦木之源
python product.py 伊丽莎白雅顿
python product.py 露得清
python product.py 丝塔芙
python product.py 宝拉珍选
python product.py 适乐肤
python product.py 多芬
python product.py 露华浓
python product.py 洛克
python product.py 纳斯
python product.py 汤姆·福特
python product.py 彼得罗夫
python product.py 芭比波朗
python product.py 馥蕾诗
python product.py 贝玲妃
python product.py 博倩叶
python product.py 津尔氏
python product.py 艾惟诺
python product.py 美宝莲
python product.py 水宝宝
python product.py 卡乐泡泡
python product.py 伯特
python product.py 菲诗丽
python product.py 蜜丝佛陀
python product.py 德美乐嘉
\ No newline at end of file
#!/bin/sh
#python product.py 海蓝之谜
python product.py 赫莲娜
python product.py 莱珀妮
python product.py 双妹
python product.py 银座
python product.py 宝丽
python product.py 法儿曼
python product.py 肌肤之钥
python product.py 希思黎
python product.py 雅诗兰黛
python product.py 兰蔻
python product.py 娇兰
python product.py 黛珂
python product.py 伊丽莎白雅顿
python product.py 后
python product.py 雪花秀
python product.py 香缇卡
python product.py 馥蕾诗
python product.py 香奈儿
python product.py Omorovicza
python product.py SK-II
python product.py 后
python product.py 雪花秀
python product.py 悦诗风吟
python product.py 爱和纯
python product.py 兰芝
python product.py 苏秘37°
python product.py 春雨
python product.py 蒂佳婷
python product.py 伊蒂之屋
python product.py 自然乐园
python product.py 美迪惠尔
python product.py 菲诗小铺
python product.py 得鲜
python product.py 德妃
python product.py 悠宜
python product.py 伊思
python product.py 芭妮兰
python product.py 梦妆
python product.py 丽得姿
python product.py 爱神菲
python product.py 谜尚
python product.py 三熹玉
python product.py 思亲肤
python product.py 艾诺碧
python product.py 赫妍
python product.py 爱敬
python product.py 九朵云
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment