Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
270 commits
Select commit Hold shift + click to select a range
4939135
2018/6/16 Uncomplete
YoTro Jun 16, 2018
06eb833
Read CN to US shipping fee in google spreedsheet
YoTro Jun 26, 2019
219a6af
Process the excel of SMT Products
YoTro Jun 27, 2019
93381fb
Update Completed Yuntushippingfee py
YoTro Jun 28, 2019
b331b78
Update captchaImg_sso.py
YoTro Jun 29, 2019
b5fd934
Create Dijkstra.py
YoTro Jan 2, 2020
a9b6942
Create pneumonia.py
YoTro Feb 11, 2020
5ca9efe
create dir for googleapi
YoTro Feb 11, 2020
96285e0
create dirs for amazon and pygame
YoTro Feb 11, 2020
5704b3f
get-pip
YoTro Feb 29, 2020
ba702d7
Generate many captchas images
YoTro Mar 22, 2020
977a2ef
graph algorithm
YoTro Mar 30, 2020
1dbb2b3
change directory
YoTro Mar 30, 2020
25209e0
updated
YoTro Apr 4, 2020
0e13e93
Calculus
YoTro Apr 5, 2020
07eb806
update
YoTro Apr 5, 2020
a76b15e
changed directory
YoTro Apr 5, 2020
713d4fb
Binary_search
YoTro Apr 6, 2020
8af4e07
update
YoTro Apr 6, 2020
9551dc8
covid-19 in China
YoTro Apr 6, 2020
b4eb654
Merge_sort
YoTro Apr 7, 2020
09890af
Insertion Sort
YoTro Apr 7, 2020
2a0a59e
Add Quick sort
YoTro Apr 8, 2020
e132416
Create listsort.txt
YoTro Apr 9, 2020
e37c35b
Update Binary_search.py
YoTro Apr 10, 2020
06409e7
png to svg
YoTro Apr 11, 2020
620d094
hashsort and upload d-path to svg
YoTro Apr 12, 2020
52cd543
Create KMP.py
YoTro Apr 13, 2020
0695cda
Update KMP.py
YoTro Apr 14, 2020
470acf1
Update KMP.py
YoTro Apr 14, 2020
da5cd5b
change directory
YoTro Apr 14, 2020
c0f0030
Bubble sort
YoTro Apr 14, 2020
1e64a2b
Create Shell_sort.py
YoTro Apr 14, 2020
095c7e9
Create Select_sort.py
YoTro Apr 15, 2020
3900b22
Create counting_sort.py
YoTro Apr 15, 2020
a4c39c0
Update counting_sort.py
YoTro Apr 15, 2020
34bc9f6
Update counting_sort.py
YoTro Apr 15, 2020
705593e
Create Bucket_sort.py
YoTro Apr 16, 2020
c3ad396
Update Bucket_sort.py
YoTro Apr 16, 2020
6da831d
Update Bucket_sort.py
YoTro Apr 16, 2020
6b9a9f3
update leetcode-69
YoTro Apr 19, 2020
3f8d9ca
bilibili_ranking_video
YoTro Apr 20, 2020
3fc3e96
Delete bilibili_ranking_data_everyday.py
YoTro Apr 20, 2020
1483aec
leetcode recursive and add __init__
YoTro Apr 20, 2020
9b5ca4b
Update bilibili_rank.sh
YoTro Apr 21, 2020
530de4d
Radix sort
YoTro Apr 21, 2020
aac43bd
Update Radix_sort.py
YoTro Apr 21, 2020
fcd760b
links
YoTro Apr 21, 2020
4295ab9
Update README.md
YoTro Apr 21, 2020
b2ea668
Update README.md
YoTro Apr 21, 2020
4eb4d8a
update radix
YoTro Apr 22, 2020
af78d5a
binary search tree
YoTro Apr 22, 2020
0c93e01
Create Zeller.py
YoTro Apr 22, 2020
59ce87d
Update BST.py
YoTro Apr 23, 2020
8be1d61
Update BST.py
YoTro Apr 23, 2020
84d2a35
Update BST.py
YoTro Apr 24, 2020
966b4a3
Update BST.py
YoTro Apr 24, 2020
aed233b
Update BST.py
YoTro Apr 24, 2020
579f41f
Create Bezier.py
YoTro Apr 25, 2020
f4c6bf7
Update BST.py
YoTro Apr 25, 2020
783727b
Update .DS_Store
YoTro Apr 25, 2020
edd1b58
update leetcode 6 questions
YoTro Apr 27, 2020
e7197cc
Update Taylor.py
YoTro Apr 27, 2020
83142c2
Create .DS_Store
YoTro Apr 27, 2020
f7db613
Create .DS_Store
YoTro Apr 27, 2020
2350c33
Update .DS_Store
YoTro Apr 27, 2020
355af8c
Create leetcode-441-arranging-coins.py
YoTro Apr 27, 2020
ce9cb21
Create leetcode-202-happy-number.py
YoTro Apr 28, 2020
c22cf8e
interpolate func
YoTro Apr 28, 2020
bce5aad
change Rename to InsertimgExcel
YoTro Apr 28, 2020
364005c
add levelordersearch and hashpathsum
YoTro Apr 30, 2020
77bb6bd
Create AVLTree.py
YoTro Apr 30, 2020
fb7fdc2
Create dingTalkfile.py
YoTro May 3, 2020
7f8fd38
Update BST.py
YoTro May 3, 2020
cee9c1c
Update AVLTree.py
YoTro May 3, 2020
9badf0f
Create Linkedlist.py
YoTro May 6, 2020
5c626e2
mt19937
YoTro May 6, 2020
a223925
Create Pascal_triangle.py
YoTro May 6, 2020
d70b213
判定两棵子树是否相同
YoTro May 6, 2020
e4ef174
杨辉三角
YoTro May 6, 2020
4eec8c3
Create __init__.py
YoTro May 6, 2020
2c2f224
Create .DS_Store
YoTro May 6, 2020
aff11b3
Create .DS_Store
YoTro May 6, 2020
68d5522
Update Linkedlist.py
YoTro May 7, 2020
7798da2
update recursive
YoTro May 8, 2020
b170ef2
Update Linkedlist.py
YoTro May 8, 2020
dc7141c
Create Catalan.py
YoTro May 8, 2020
39d0a26
update
YoTro May 12, 2020
2279e16
Create Hanoi_Tower.py
YoTro May 12, 2020
184d18b
Update leetcode-5-longest-palindromic-substring.py
YoTro May 12, 2020
8c3255a
update directorytree and loginleetcode
YoTro May 14, 2020
e3ae64b
Create leetcode-464-can-i-win.py
YoTro May 15, 2020
007f46a
Update leetcode-464-can-i-win.py
YoTro May 15, 2020
34e5604
update
YoTro May 15, 2020
3267b26
Update README.md
YoTro May 15, 2020
baa98f4
Update leetcode-464-can-i-win.py
YoTro May 17, 2020
1e4c1ad
Create Primenumber.py
YoTro May 17, 2020
4399863
Create leetcode-152-maximum-product-subarray.py
YoTro May 20, 2020
efaf785
Create leetcode-486-maximum-length-of-repeated-subarray.py
YoTro May 20, 2020
be57024
Create leetcode-279-perfect-squares.py
YoTro May 20, 2020
f5a098f
Create leetcode-1371-find-the-longest-substring-containing-vowels-in-…
YoTro May 20, 2020
679be25
Update leetcode-231-power-of-two.py
YoTro May 20, 2020
b2ea063
Create leetcode-95-unique-binary-search-trees-ii.py
YoTro May 20, 2020
69c552b
Delete leetcode-95-unique-binary-search-trees-ii.py
YoTro May 20, 2020
dfa8b9c
update
YoTro May 20, 2020
f69e1c8
Create leetcode-322-coin-change.py
YoTro May 22, 2020
47fa079
Update leetcode-231-power-of-two.py
YoTro May 22, 2020
03c31ce
Create OnlineC.py
YoTro May 22, 2020
295eeb8
Create OnlineCompileMultilangs.py
YoTro May 22, 2020
e85ac5d
Create LICENSE
YoTro May 23, 2020
4f1cb98
Update leetcode-322-coin-change.py
YoTro May 24, 2020
477c7ca
Create DFS_Maze.py
YoTro May 26, 2020
be70209
Create leetcode-1263-minimum-moves-to-move-a-box-to-their-target-loca…
YoTro May 26, 2020
11d218a
Create Recursive_division_Maze.py
YoTro May 26, 2020
32ed4ea
Delete price正则.txt
YoTro May 26, 2020
7c0cd13
Create price正则.txt
YoTro May 26, 2020
7ca547c
Create Prim_Maze.py
YoTro May 27, 2020
5102f1a
Create Tarjan.py
YoTro May 31, 2020
5df5e60
Create Astar.py
YoTro May 31, 2020
f21c536
Update Prim_Maze.py
YoTro May 31, 2020
6e32cbd
Update leetcode-1263-minimum-moves-to-move-a-box-to-their-target-loca…
YoTro Jun 1, 2020
71c21a1
Create leetcode-837-new-21-game.py
YoTro Jun 3, 2020
cbed378
Create Binaryheap.py
YoTro Jun 9, 2020
25c133d
Create Heap_sort.py
YoTro Jun 9, 2020
b78d2d1
update name
YoTro Jun 9, 2020
4e803fc
Update Heap_sort.py
YoTro Jun 9, 2020
0e2f325
Create PageRank.py
YoTro Jun 14, 2020
060c223
Create Pygraph.py
YoTro Jun 15, 2020
945e257
Update .gitignore
YoTro Jun 15, 2020
02f6070
Create 6.py
YoTro Jun 15, 2020
fe03316
Update 6.py
YoTro Jun 15, 2020
e727486
Create 7.py
YoTro Jun 16, 2020
f58aa7b
Create 8.py
YoTro Jun 16, 2020
48f2591
Create 9.py
YoTro Jun 16, 2020
aa14082
Create 10.py
YoTro Jun 16, 2020
eb5376b
Create 11.py
YoTro Jun 16, 2020
8e3771d
Create 12.py
YoTro Jun 16, 2020
6387c5f
Create 13.py
YoTro Jun 17, 2020
f8911de
Create 14.py
YoTro Jun 17, 2020
332ed06
Create 15.py
YoTro Jun 17, 2020
5ef7fd0
Update 13.py
YoTro Jun 17, 2020
89b8795
Create Trie_Tree.py
YoTro Jun 29, 2020
62eaa23
Create 16.py
YoTro Jun 30, 2020
4de91e2
add machinelearning
YoTro Jul 12, 2020
03ce4b2
Create leetcode-jianzhioffer-51-shu-zu-zhong-de-ni-xu-dui-lcof.py
YoTro Jul 15, 2020
118ed3a
Update Tarjan.py
YoTro Jul 18, 2020
de8483c
Create leetcode-866-prime-palindrome.py
YoTro Jul 22, 2020
3687cab
Update Primenumber.py
YoTro Jul 22, 2020
17e8491
Create amazon_comments.py
YoTro Aug 26, 2020
6e884f9
Add files via upload
YoTro Aug 27, 2020
bb15643
椭圆周长
YoTro Oct 27, 2021
25aca48
Update amazon.py
YoTro May 13, 2022
4e1be68
README.md
YoTro May 13, 2022
ce84d00
Update Get_questions.py
YoTro May 13, 2022
bf4aa44
upload Get_Amazon_bestsellers.py
YoTro May 16, 2022
7e25b72
Add files via upload
YoTro Dec 28, 2022
692dd1e
获取Amazon_Q&A
YoTro Feb 22, 2023
7e4c936
获取FBA包装重和包装体积
YoTro Feb 23, 2023
8fce50b
把部分通用函数放在一个文件Amazon_Utils.py里
YoTro Feb 23, 2023
5388b44
增加判断是否变狗函数
YoTro Feb 25, 2023
d756d27
模拟登陆卖家精灵,获取全部扩展流量词
YoTro Feb 28, 2023
ffbaeb6
Update README.md
YoTro Feb 28, 2023
907b2ad
Update README.md
YoTro Feb 28, 2023
1a32b19
Update README.md
YoTro Feb 28, 2023
a3fea6b
Update README.md
YoTro Feb 28, 2023
f6b9e46
增加卖家精灵插件登陆及获取asin BRS
YoTro Mar 4, 2023
165cc6b
保存历史bsr到表格
YoTro Mar 5, 2023
7eb88ad
Delete amazon_cn.py
YoTro Mar 6, 2023
eb5f947
Delete amazon_us.py
YoTro Mar 6, 2023
0be4cf3
Delete AddtoCart.py
YoTro Mar 6, 2023
477c3c0
Delete amazon.py
YoTro Mar 6, 2023
aa4735c
Delete get_ppc.py
YoTro Mar 6, 2023
ef9c1fe
Delete AWSsellerxt.py
YoTro Mar 6, 2023
c15f93c
Delete AWSRegister.py
YoTro Mar 6, 2023
219c3a9
Delete captchaImg_sso.py
YoTro Mar 7, 2023
dbe07e7
Delete Get_AmazonProducts_num.py
YoTro Mar 9, 2023
ca2639c
添加装饰器retry和Get_Exceldata函数
YoTro Mar 9, 2023
22f2a90
Add files via upload
YoTro Mar 9, 2023
a8c4f1b
Add files via upload
YoTro Mar 9, 2023
f140e1b
批量获取asin在某个关键词的搜索排名,返回页数,单页排名到表格
YoTro Mar 9, 2023
e41c0b4
Update Amazon_Utils.py
YoTro Mar 9, 2023
1008e7b
Update Get_Amazon_keywords_rank.py
YoTro Mar 9, 2023
68084ae
Update Get_Amazon_keywords_rank.py
YoTro Mar 10, 2023
c7e0879
Delete pytree.txt
YoTro Mar 10, 2023
647bb6d
Delete pytree.html
YoTro Mar 10, 2023
c8d4d43
Delete taobaoSEO_keyword.pyc
YoTro Mar 10, 2023
2bfc9dd
Delete dingTalkfile.py
YoTro Mar 10, 2023
74f62d5
Delete InsertimgExcel.py
YoTro Mar 10, 2023
c164dc5
Delete csv_to_xls.py
YoTro Mar 10, 2023
2cab370
Delete Logistics_get_17track.py
YoTro Mar 10, 2023
2cd7dfb
Delete pneumonia.py
YoTro Mar 10, 2023
09f5c56
Delete price正则.txt
YoTro Mar 10, 2023
4386cf6
Delete Get_questions.py
YoTro Mar 10, 2023
86c12b2
增加File_path_choice,is_TTD,is_bash
YoTro Mar 11, 2023
c2403fc
Update Amazon_Utils.py
YoTro Mar 12, 2023
7a562ff
Update Get_Amazon_keywords_rank.py
YoTro Mar 12, 2023
d672bef
Update Get_Amazon_QA.py
YoTro Mar 12, 2023
5872caf
Update Get_FBA_Package_Weight_Dimensions.py
YoTro Mar 12, 2023
946c063
Update Sellersprite.py
YoTro Mar 12, 2023
787eb5e
Update postTocart.py
YoTro Mar 12, 2023
fa35cba
Delete AWS_captchaImage.py
YoTro Mar 12, 2023
42f0624
依赖库requirement.txt
YoTro Mar 13, 2023
8ac5808
Delete xt.py
YoTro Mar 13, 2023
b579164
Update Is_Amz_videos.py
YoTro Mar 13, 2023
1119f12
获取Amazon搜索结果中展现的销量
YoTro Mar 15, 2023
8c1a838
Update Amazon_Utils.py
YoTro Mar 16, 2023
fd17b9e
获取ASIN承运商
YoTro Mar 16, 2023
7dd800c
Update postTocart.py
YoTro Mar 16, 2023
de3ba6f
Update 51job.py
YoTro Apr 17, 2023
f8e56dd
Update 51job.py
YoTro Apr 19, 2023
9e2e1bb
Update requirements.txt
YoTro Apr 19, 2023
f1397be
Create proxy.py
YoTro Apr 19, 2023
fecf37b
Create freeproxies.py
YoTro Apr 19, 2023
2e7f495
Create proxies.txt
YoTro Apr 19, 2023
f52b416
zhipin
YoTro Apr 20, 2023
263aedc
Create RPC.png
YoTro Apr 20, 2023
73f7e44
Update README.md
YoTro Apr 20, 2023
1711c6b
Update README.md
YoTro Apr 20, 2023
81125fc
Update websocketclient.py
YoTro Apr 21, 2023
18d8e32
Update websocketserver.py
YoTro Apr 21, 2023
bc7f73b
Update zhipin.py
YoTro Apr 21, 2023
9e0e6f7
Delete main.js
YoTro Apr 21, 2023
2b12bab
Create main.js
YoTro Apr 21, 2023
dd00263
Update README.md
YoTro Apr 21, 2023
bfbb5bf
Update requirements.txt
YoTro Apr 23, 2023
06e02b2
Update zhipin.py
YoTro Apr 23, 2023
1cd0539
Update main.js
YoTro Apr 23, 2023
4441f17
Update requirements.txt
YoTro Apr 24, 2023
a15acb5
Update main.js
YoTro Apr 24, 2023
f1f88f8
Create app.py
YoTro Apr 24, 2023
816c9eb
Update README.md
YoTro Apr 24, 2023
f79a0e4
Update main.js
YoTro Apr 24, 2023
67685c4
Update zhipin.py
YoTro Apr 24, 2023
1fa9556
Update main.py
YoTro Apr 24, 2023
62c37c3
Update README.md
YoTro Apr 24, 2023
7321404
Delete zp_stoken.txt
YoTro Apr 26, 2023
2d46863
Update zhipin.py
YoTro Apr 26, 2023
af4205f
Update main.py
YoTro Apr 26, 2023
ac6ac00
Create Amap.py
YoTro Apr 26, 2023
f37d64c
Update README.md
YoTro Apr 26, 2023
a830192
Delete Google_translate_js_API.py
YoTro Apr 27, 2023
f742a1e
delete
YoTro Apr 27, 2023
cf78a25
Add Tree Instruction
YoTro Apr 27, 2023
c672d36
Create Linkedlist.py
YoTro Apr 27, 2023
25acc9f
Create Googletranslate.py
YoTro Apr 27, 2023
9dba3d4
add Utils
YoTro Apr 27, 2023
7046874
add 51job
YoTro Apr 28, 2023
8669ce7
Create __init__.py
YoTro Apr 28, 2023
ffdf2bd
Create __init__.py
YoTro Apr 28, 2023
752c9d0
Bump requests from 2.21.0 to 2.31.0 in /bilibili
dependabot[bot] May 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ ENV/

# mypy
.mypy_cache/
bilibili/log
.DS_Store
bilibili/log.err
9 changes: 0 additions & 9 deletions 5.py

This file was deleted.

Binary file added AWS/.DS_Store
Binary file not shown.
193 changes: 193 additions & 0 deletions AWS/Amazon_Utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# -*- coding:UTF-8 -*-
import xlrd
import xlwt
import os
import re
import requests
def is_bash():
'''判断使用平台'''
if platform.system().lower() == "windows":
return 0
if platform.system().lower() == 'darwin' or platform.system().lower() == 'linux':
return 1
def is_TTD(f):
'''是否被Amazon屏蔽请求变狗'''
temp = f
if(re.findall("(_TTD_\.jpg)", f)):
return 1
else:
return 0
def retry(func):
'''装饰器:try最多5次'''
def wrap(*args):
i = 0
r = None
while i<5:
try:
r = func(*args)
if r:
i = 5
except Exception as e:
i+=1
return r
return wrap

def excel_bulit(workbook, asin):
'''Bulit a excel.构建Excel'''
table= workbook.add_sheet("{}".format(asin),cell_overwrite_ok=True)
style = xlwt.XFStyle()#设置样式
font = xlwt.Font()#设置字体
font.name = 'SimSun' # 指定“宋体”
style.font = font
alignment=xlwt.Alignment()#设置对齐
alignment.horz=xlwt.Alignment.HORZ_CENTER#单元格字符水平居中
# 格式: HORZ_GENERAL, HORZ_LEFT, HORZ_CENTER, HORZ_RIGHT, HORZ_FILLED, HORZ_JUSTIFIED, HORZ_CENTER_ACROSS_SEL, HORZ_DISTRIBUTED
alignment.vert=xlwt.Alignment.VERT_CENTER#单元格字符垂直居中
#格式: VERT_TOP, VERT_CENTER, VERT_BOTTOM, VERT_JUSTIFIED, VERT_DISTRIBUTED
style.alignment=alignment#添加至样式
return table

def Get_ASINlists(fn):
'''从表格里获取ASINURL'''
data=xlrd.open_workbook(fn) # 打开工作薄
sheets=data.sheets()
z={}
p=0
for sheet in sheets:
p+=1
z[p]=sheet.name
print(p,z[p])
try:
sheet_index=int(input("plz input index in the serial number(default 1):\n"))
if sheet_index in range(1,len(sheets)+1):
t=sheet_index
else:
print('The digital is wrong,plz input a correct number')
except Exception as e:
print(str(e))
t=1
table=data.sheet_by_index(t-1) # 读取指定sheet
cols=table.ncols
rows=table.nrows
print("{0}'s rows ,cols are {1},{2}".format(z[t],rows,cols))
first_sheet=table.row_values(0)
try:
url_index=first_sheet.index('ASIN')#返回第一行URL的列数
except Exception as e:
print(e)
return []
ASINs=table.col_values(url_index) # 读取指定列(该列含有URL)
ASINs.pop(0)
return ASINs
def Get_Exceldata(fn, colname):
'''从表格里获取任意列数组'''
if not os.path.exists(fn):
print("Doesn't exist: {}".format(os.path.abspath(fn)))
return None
data=xlrd.open_workbook(fn) # 打开工作薄
sheets=data.sheets()
z={}
p=0
for sheet in sheets:
p+=1
z[p]=sheet.name
print(p,z[p])
try:
sheet_index=int(input("plz input index in the serial number(default 1):\n"))
if sheet_index in range(1,len(sheets)+1):
t=sheet_index
else:
print('The digital is wrong,plz input a correct number')
except Exception as e:
print(str(e))
t=1
table=data.sheet_by_index(t-1) # 读取指定sheet
cols=table.ncols
rows=table.nrows
print("{0}'s rows ,cols are {1},{2}".format(z[t],rows,cols))
first_sheet=table.row_values(0)
try:
url_index=first_sheet.index(colname)#返回第一行URL的列数
except Exception as e:
print(e)
return []
ASINs=table.col_values(url_index) # 读取指定列(该列含有URL)
ASINs.pop(0)#去掉表头
return ASINs

def File_path_choice():
'''选择文件夹中的文件,返回所选文件路径'''
t='./stainless steel toilet brush holder.xlsx'#默认工作簿地址
try:
file_path='.'
print('当前路径{0}文件夹中的文件和文件夹如下:'.format(os.path.abspath(file_path)))
file_names=os.listdir(file_path)#列出下载文件夹中的文件名
for i in range(len(file_names)):
print(i+1,file_names[i])
file_num=int(raw_input("Default workbook is 1,plz input a number of serial number(default {0}):\nOr Enter a number more than the last option you could input a url of file\n ".format(t)))#默认文件名是t,或者输入比最后选项大的数
if file_num in range(1,len(file_names)+1):
file_path=file_path+'/'+file_names[file_num-1]
if file_num>=len(file_names)+1:
file_path=str(raw_input("plz input a fileurl (like:D:\\Documents\\Downloads\1.xlsx or /Users/\{name\}/Projects/1.xls\n"))
f=os.path.exists(file_path)
while f==False:
file_path=str(raw_input("Your file is not exsits,plz input a fileurl:\n"))
f=os.path.exists(file_path)
except Exception as e:
print(str(e))
file_path=t
return file_path

def is_Captcha(f, host, asin, session, headers):
'''Amazon验证码'''
url = re.findall("(https://images-na.ssl-images-amazon.com/captcha.*?jpg)", f)
i = 0
while url:
captcha = AmazonCaptcha.fromlink(url[0])
text = captcha.solve()
# with open('./t.html', 'w') as f:
# f.write(r)
# f.close()
validateCaptcha_url = host+"/errors/validateCaptcha"
amzn = re.findall("name=\"amzn\" value=\"(.*?)\"", f)[0]
amzn_r = re.findall("name=\"amzn-r\" value=\"(.*?)\"", f)[0]
params = {
"amzn": amzn,
"amzn-r": html.unescape(amzn_r),
"field-keywords": text
}
validateCaptcha_url = validateCaptcha_url+"?"+ urllib.parse.urlencode(params)
print(validateCaptcha_url)
r = session.get(validateCaptcha_url, headers = headers, timeout = 5)#Amazon验证请求
u = host+asin
r = session.get(u, headers=headers, timeout = 5)
f = r.text
print(url)
url = re.findall("(https://images-na.ssl-images-amazon.com/captcha.*?jpg)", f)
i += 1
if i == 5:
url = []
return f, session

def requests_asin(host, asin):
'''Get the content of Amazon listing web page.获取listing网页内容'''
headers={
'Connection':'keep-alive',
'sec-ch-ua':'"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',
'sec-ch-ua-mobile':'?0',
'sec-ch-ua-platform':'"macOS"',
'Upgrade-Insecure-Requests':'1',
'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
'Sec-Fetch-Site':'none',
'Sec-Fetch-Mode':'navigate',
'Sec-Fetch-User':'?1',
'Sec-Fetch-Dest':'document',
'Accept-Encoding':'gzip, deflate, br',
'Accept-Language':'en-US,en;q=0.9'
}#浏览器头部
#proxies={'HTTP': 'HTTP://127.0.0.1:1081', 'HTTPS': 'HTTPS://127.0.0.1:1081'}#免费代理IP
session=requests.Session()
url = host+'/dp/'+asin
r = session.get(url, headers=headers, timeout = 5)
return is_Captcha(r.text, host, asin, session, headers)
149 changes: 149 additions & 0 deletions AWS/Amazozn_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# -*- conding:UTF-8 -*-
# Author:Toryun
# Python version:2.7.13
# Date:18/3/25
# Function:Create a style Excel in special situation生成指定表格,写入随机Email和密码
#Amazom CAPTCHA IMG API https://www.amazon.com/ap/captcha?appAction=REGISTER&amp;captchaObfuscationLevel=ape:aGFyZA==&amp;captchaType=image
import random
import requests
import xlwt
import xlrd
import datetime,time
import mechanize
import os
import cookielib
import sys
from PIL import Image
import re
#---------------------------------------------------------------------------------
def excel_bulit():
#Bulit a excel,Generate a account of Amazon 构建Excel,生成亚马逊账号
workbook = xlwt.Workbook(encoding = 'utf-8')
table= workbook.add_sheet("data",cell_overwrite_ok=True)
style = xlwt.XFStyle()#设置样式
font = xlwt.Font()#设置字体
font.name = 'SimSun' # 指定“宋体”
style.font = font
alignment=xlwt.Alignment()#设置对齐
alignment.horz=xlwt.Alignment.HORZ_CENTER#单元格字符水平居中
# 格式: HORZ_GENERAL, HORZ_LEFT, HORZ_CENTER, HORZ_RIGHT, HORZ_FILLED, HORZ_JUSTIFIED, HORZ_CENTER_ACROSS_SEL, HORZ_DISTRIBUTED
alignment.vert=xlwt.Alignment.VERT_CENTER#单元格字符垂直居中
#格式: VERT_TOP, VERT_CENTER, VERT_BOTTOM, VERT_JUSTIFIED, VERT_DISTRIBUTED
style.alignment=alignment#添加至样式

for i in range(0,100):
t='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
t1=''.join(random.sample(t,8))
b1=''.join(random.sample(t,8))
mail=t1+'@gmail.com'
table.write(i,0,mail,style)
table.write(i,1,b1,style)
file_save='C:\\Users\\Administrator\\Desktop\email.xls'
workbook.save(file_save)

#---------------------------------------------------------------------------------
#Reading account accounts and passwords
#读取账户账号和密码
def read_excel(i):
'''Read account and password from workbook读取工作簿中的账号密码'''
workbook=xlrd.open_workbook('C:\\Users\\Administrator\\Desktop\email.xls')
table=workbook.sheet_by_index(0)
account=table.col_values(0)
password=table.col_values(1)
a=account[i]
p=password[i]
return a,p
#---------------------------------------------------------------------------------
#Register Amazon(Using mechanize library to simulate browser registration)
#注册亚马逊(使用mechanize库模拟浏览器注册)
def register(name,account,password,i):
'''Using the mechanize lib simulation browser to large quantity register Amazon accounts使用mechanize模拟浏览器批量注册亚马逊账号'''
url='https://www.amazon.com/ap/register?openid.pape.max_auth_age=0&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&pageId=usflex&ignoreAuthState=1&openid.return_to=https%3A%2F%2Fwww.amazon.com%2F%3Fref_%3Dnav_ya_signin&prevRID=3CBEZNC1DVKVH5BS3CQT&openid.assoc_handle=usflex&openid.mode=checkid_setup&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&prepopulatedLoginId=&failedSignInCount=0&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0'
br = mechanize.Browser()
br.set_handle_equiv(True)#handle HTTP-EQUIV headers (HTTP headers embedded in HTML).
br.set_handle_redirect(True)
br.set_handle_referer(True)#add Referer (sic) header
br.set_handle_robots(False)# Ignore robots.txt. Do not do this without thought and consideration.
br.set_handle_gzip(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0')]
proxies={"HTTPS": "HTTPS://122.242.96.30:808"}#proxy代理
br.set_proxies(proxies)
for tries in range(10):#解决100610错误问题(代理连接问题)
try:
br.open(url)
except:
if tries<=10:
continue
else:
break
br.select_form(nr=0)
br.form['customerName']=name
br.form['email']=account
br.form['password']=password
br.form['passwordCheck']=password
br.submit()
response=str(br.response().read())
try:#如果需要验证进行以下操作
img_url=re.findall(r'<img alt="Visual CAPTCHA image, continue down for an audio option." src="(.*?)" data-refresh-url',response)#读取验证码图片
headers={"Host":
"opfcaptcha-prod.s3.amazonaws.com",
"Referer":
"https://www.amazon.com/ap/register",
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0",
"Accept":
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language":
"zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
"Accept-Encoding":
"gzip, deflate, br",
"Connection":
"keep-alive",
"Upgrade-Insecure-Requests":"1"
}
if img_url[0]:
img_url0=img_url[0].replace("&amp;","&",2)
print 'Need captcha'
r=requests.get(img_url0,headers=headers,proxies=proxies)#下载验证码图片
print r.status_code
if r.status_code==200:
_img_0="d:jpg/"+str(i)+".jpg"#存储验证码图片路径
with open(_img_0,"wb") as _img_1:
_img_1.write(r.content)
_img_1.close()
img = Image.open(_img_0)
img.show()
guess=raw_input('Plz input Type characters you see:\n')
command = 'taskkill /F /IM dllhost.exe'#强制终止指定进程名命令
os.system(command)
br.select_form(nr=0)
br.form['password']=password
br.form['passwordCheck']=password
br.form['guess']=guess
br.submit()
except Exception,e:
print str(e)
pass
#---------------------------------------------------------------------------------
#Simulate download progress of Lniux
#模拟Lniux下载进度条
def progress(i):
r='\r%s>%d%%' % ('#' * i, i,)
sys.stdout.write(r)
sys.stdout.flush()#Refresh progress刷新进度条
def rate_progress(i):
sys.stdout.write('\r%2d%%')
sys.stdout.flush()

if __name__=='__main__':
t1=datetime.datetime.now()
excel_bulit()
print 'email is built,now register amazon account\n完成进度:\n'.decode('utf-8')
for i in range(0,100):
a,p=read_excel(i)
register(name=p,account=a,password=p,i=i)
time.sleep(random.randint(0,6))#随机休息0到6秒
progress(i)
t2=datetime.datetime.now()
print "\nThe cost time is {0}.\nThe workbook is saved in {1}".format(t2-t1,'C:\\Users\\Administrator\\Desktop\email.xls' )
Loading