Tencent recruitment climb

. 1  Import Requests
 2  Import Time
 . 3  Import JSON
 . 4  Import Threading
 . 5  #    collection https://careers.tencent.com/search.html site jobs 
. 6  
. 7  #    timestamp 
. 8 timestamp = ' % D ' % (the time.time ( ) * 1000 )
 . 9  
10  
. 11  #    request url, parses the data 
12 is  DEF parse_url (json_url):
 13 is      #    initiation request 
14      RES = requests.get (json_url) .json ()
 15      for I inRES [ ' the Data ' ] [ ' Posts ' ]:
 16          #    job title 
. 17          title = I [ ' RecruitPostName ' ]
 18 is          #    duties 
. 19          resbity = I [ ' Responsibility ' ]
 20 is          #    job ID 
21 is          ID = I [ ' the PostID ' ]
 22          #    position link 
23 is          posi_url = ' https://careers.tencent.com/jobdesc.html?postId= ' + ID
24          #    to find a job details page content based on ID 
25          id_url = ' https://careers.tencent.com/tencentcareer/api/post/ByPostId?timestamp={}&postId={}&language=zh-cn ' .format (
 26              timestamp, ID)
 27          res_ment = requests.get (id_url) .json ()
 28          #    work in claim 
29          Re-Ment res_ment = [ ' the Data ' ] [ ' the requirement ' ]
 30          #    published 
31 is          posi_time = I [ ' LastUpdateTime ' ]
 32          Item ={
 33              ' Position ' : title,
 34 is              ' duty ' : resbity,
 35              ' required ' : Re-Ment,
 36              ' link ' : posi_url,
 37 [              ' time ' : posi_time
 38 is          }
 39          Print ( ' being written → ' , Item)
 40          Open with ( ' Tencent recruitment .json ' , ' A ' , encoding = ' UTF-. 8 ' ) AS F:
 41 is             f.write (json.dumps (Item, ensure_ascii = False) + ' \ n- ' )
 42 is  
43 is  
44 is  # pages 
45 NUM = 10
 46 is t_list = []
 47  for COUNT in Range (. 1, NUM +. 1 ):
 48      Print ( ' load the first page data {} ' .format (COUNT))
 49      #    JSON data source 
50      json_url = ' https://careers.tencent.com/tencentcareer/api/post/Query?timestamp={}&countryId=&cityId= & bgIds = & productId = & categoryId = & parentCategoryId = & attrId = & keyword = & pageIndex = {} & pageSize = 10 &language=zh-cn&area=cn'.format(
51         timestamp, count)
52     t = threading.Thread(target=parse_url, args=((json_url,)))
53     t_list.append(t)
54 
55 for t in t_list:
56     t.start()
57 for t in t_list:
58     t.join()
Tencent Recruitment

 

Guess you like

Origin www.cnblogs.com/jiyu-hlzy/p/11814265.html