Python mining helps yo yo
Publish: 2021-05-19 12:02:08
1. Add cookies
1. Here you need to add two cookies, one is. Cnblogs, the other is. Cnlogs. Aspnetcore. Cookies
2. The webpage I open here is the homepage of my blog: htt
gs.com/yoketang. I didn't enter the login page
3. Refresh the page after adding cookies, and then it's time to witness the miracle
2.20.5 reference code:
# coding:utf-8
from selenium import webdriver
import time driver = webdriver.Firefox()
driver.get(" htt
ogs.com/yoyoketang")
# add cookie C1 = {U & # 39; domain': u'. cnblogs.com', u' name': u'. CNBlogsCookie', u' value': u' xxxx', u' expiry': 1491887887, u' path': u'/ 39;, u' httpOnly': True, u' secure': False}
c2 = {u' domain': u'. cnblogs.com', u' name': u'. Cnblogs.AspNetCore.Cookies', u' value': u' xxxx', u' expiry': 1491887887, u' path': u'/ 39;, u' httpOnly': True, u' secure': False} driver.add_ Cookie (C1)
? Add 2 values
driver.add_ Cookie (C2)
time. Sleep (3)
? Refresh the next page to witness the miracle
driver. Refresh()
there are several points to note:
1. Check the next automatic login button when logging in< br />2.add_ Cookie () only adds name and value, which is not successful for blog Garden login
3. This method is not suitable for all websites. Generally, it is suitable for those who remember the login status, such as blog Garden
1. Here you need to add two cookies, one is. Cnblogs, the other is. Cnlogs. Aspnetcore. Cookies
2. The webpage I open here is the homepage of my blog: htt
gs.com/yoketang. I didn't enter the login page
3. Refresh the page after adding cookies, and then it's time to witness the miracle
2.20.5 reference code:
# coding:utf-8
from selenium import webdriver
import time driver = webdriver.Firefox()
driver.get(" htt
ogs.com/yoyoketang")
# add cookie C1 = {U & # 39; domain': u'. cnblogs.com', u' name': u'. CNBlogsCookie', u' value': u' xxxx', u' expiry': 1491887887, u' path': u'/ 39;, u' httpOnly': True, u' secure': False}
c2 = {u' domain': u'. cnblogs.com', u' name': u'. Cnblogs.AspNetCore.Cookies', u' value': u' xxxx', u' expiry': 1491887887, u' path': u'/ 39;, u' httpOnly': True, u' secure': False} driver.add_ Cookie (C1)
? Add 2 values
driver.add_ Cookie (C2)
time. Sleep (3)
? Refresh the next page to witness the miracle
driver. Refresh()
there are several points to note:
1. Check the next automatic login button when logging in< br />2.add_ Cookie () only adds name and value, which is not successful for blog Garden login
3. This method is not suitable for all websites. Generally, it is suitable for those who remember the login status, such as blog Garden
2. http://www.cnblogs.com/yoyoketang/archive/2016/12.html
look at her blog and WeChat official account
pdf.
look at her blog and WeChat official account
pdf.
Hot content