本帖最后由 lizhiyong_11 于 2021-5-9 22:16 编辑
下面是我的代码,用的你的正则表达式,只匹配出来了这个东西['98-2021'],源代码里面确实有这个数字,但是我只单独运行你的代码,结果确是正确的['86-574-86178908', '86-13777226846'],,好奇怪啊,为什么呢
headers = {
'Cookie': 'pid=zkuMTg5LjQ3LjI0OTIwMjEwNDI5MjExMzQzMjc3NjIzMjk2ODMM; webp=t; sf_img=AM; __pd=1f4es732u3e7; _skwd=29tX35Ib3BwZXIgRHJ5ZXJ+ISxjb21fflBsYXN0aWNzIERyeWVyfiEsY29tX35Ib3BwZXIY; _pd=zU1ODcwMDUyN; se=zkuMTg5LjQ2LjIxODIwMjEwNTA5MDkwODQzNjY5MzA2MDgyNTEM; dpr=1; prid=14114; cid=jAyMTA1MDkwOTE2MTU5NzQwMDA6MDE0OTgyMDI2OTQ1NDY3MzcyMDEM; sid=jc2MzMwMjIzNDI1MzQ4OTM6MzkuMTg5LjQ2LjIxODoxNzQ3MTc5NjE1OjAwM; cbid=Tc0NzE3OTYxNTowMAM; wel_name=GlqaXUb; loginSource=1; CPID=HCO0LGq54TeiECTodDZVlAA+sTjC7zrI; LOGT=Vz74ApnMt6WX7OfMdZNt7vNcgDl8hkUw; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22ovSfXTtDElVd_00%22%2C%22first_id%22%3A%221791dc38d0e978-002524cc5f97d9-3e604809-2764800-1791dc38d0f854%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22%24device_id%22%3A%221791dc38d0e978-002524cc5f97d9-3e604809-2764800-1791dc38d0f854%22%7D; _cwd=pOdQnEWAJaVy_HwSxULEdCGWN_bNyxZRgjnmWT_JNGmnylAmUkf_JXknSWNCXVpE; hd_symbol=G9wcGVyIGRyeWVya; _kwd=HJvZF9+aG9wcGVyIGRyeWVyciEsfHJvZF9+aG9sbG93IG1ldGFsIGRvb3IciEsfHJvZF9+aW5kdXN0aWRhIGNoaWxsZXIciEsfHJvZF9+aG9wcGVyIGR5ZXIciEsfHJvZF9+aW5kdXN0cmlhbCBjaGlsbGVyc; _psl=yJmYyI6WyIzNCIsIjE5IiwiMTUiXX0e; lg=_~@~_~@~7X1gGfvOX/c3f+IS94wdYiN+PzD0t7ZE~@~7X1gGfvOX/e/B6j5FV5FXj7modlZY/lyuIBjykrprT8=~@~_~@~; JSESSIONID=8B70E9D4867F8FD68ADCBE05628F941B; LVT=dCwB46pc0Gd7y8Sd8dLz9uqoWFbEHhmH',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'}
res_new = requests.get(i, headers=headers)
result = re.findall(r'\d\d-\d{3,11}-*\d{0,8}', res_new.text)[:2]
print(result)
|