国外常用浏览器User-Agent汇总

编程入门 行业动态 更新时间:2024-10-26 16:33:49

CSV文件,一共收录9529条User-Agent,可直接用excel打开或导入数据库
网盘链接: https://pan.baidu/s/1NdlLUvLM0nDnrC8Ax1F-QA 提取码: ztte
内容示例:

idagent
1411Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14931
1412Chrome (AppleWebKit/537.1; Chrome50.0; Windows NT 6.3) AppleWebKit/537.36 (KHTML like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393
1413Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.9200
1414Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586
1415Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246
1416Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533+ (KHTML, like Gecko) Element Browser 5.0
1417ELinks/0.9.3 (textmode; Linux 2.6.9-kanotix-8 i686; 127x41)
1418ELinks/0.9.3 (textmode; Linux 2.6.11-auditor-10 i686; 80x24)
1419ELinks/0.9.3 (textmode; Linux 2.6.11 i686; 79x24)
1420ELinks (0.4pre6; Linux 2.2.19ext3 alpha; 80x25)

使用示例:
首先将CSV表导入数据库pvAgent.db中的AgentTable,我用的是python自带的sqlite3数据库

import sqlite3
import random
import requests
import time

# 连接数据库pvAgent.db,从数据表AgentTable随机取一条User-Agent并返回
def randomUserAgent():
    connection = sqlite3.connect("pvAgent.db")
    cursor = connection.cursor()
    cursor.execute("CREATE TABLE IF NOT EXISTS AgentTable(_id INTEGER PRIMARY KEY AUTOINCREMENT, agent VARCHAR(1024))")
    lastIDCursor = cursor.execute("select * from AgentTable order by _id desc limit 1")
    userAgentRandomID = 0
    for lastID in lastIDCursor:
        userAgentRandomID = random.randint(1, lastID[0])
    userAgentRow = cursor.execute("select * from AgentTable where _id=%d" % userAgentRandomID)
    for userAgent in userAgentRow:
        agentStr = userAgent[1]
        connection.close()
        return agentStr

if __name__ == '__main__':
    while(True):
        # 调用randomUserAgent()函数从数据表AgentTable中随机抽一条User-Agent来使用
        agent = randomUserAgent()
        ip = '119.57.108.53'
        headers = {'User-Agent' : agent}
        proxies = {'http' : ip}
        requests.get('https://www.baidu', headers=headers, proxies=proxies, verify=True)
        print('Access to success.')
        time.sleep(1)

更多推荐

国外常用浏览器User-Agent汇总

本文发布于:2023-06-13 18:40:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1390099.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   常用   国外   Agent   User

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!