评论者ip最后一位用*隐去方法

 
?
string str= "127.0.0.1" ;
str = str.Substring(0, str.LastIndexOf( "." )+1);
Response.Write(str + "*" );

转载于:https://www.cnblogs.com/wifi/articles/2480265.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
爬取淘宝评论需要模拟浏览器行为,一般使用 Selenium 或者 Pyppeteer 这样的工具来实现。以下是一个使用 Selenium 爬取淘宝商品评论的示例代码: ```python from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By import time # 设置 Chrome 浏览器的启动参数 options = webdriver.ChromeOptions() options.add_argument("--headless") options.add_argument("--disable-gpu") options.add_argument("--no-sandbox") # 设置 Chrome 浏览器的驱动路径 driver_path = "/usr/local/bin/chromedriver" # 创建 Chrome 浏览器的实例 driver = webdriver.Chrome(options=options, executable_path=driver_path) # 打开淘宝商品页面 url = "https://item.taobao.com/item.htm?id=618163391276" driver.get(url) # 切换到商品评论的 iframe 中 iframe = driver.find_element_by_id("sufei-dialog-content") driver.switch_to.frame(iframe) # 等待评论数据加载完毕 wait = WebDriverWait(driver, 10) wait.until(EC.presence_of_element_located((By.CLASS_NAME, "tb-rev-item"))) # 模拟滚动页面获取更多评论数据 comments = [] while True: # 获取页面上的所有评论 comment_items = driver.find_elements_by_class_name("tb-rev-item") # 提取评论文本 for comment_item in comment_items: comment = comment_item.find_element_by_class_name("tb-rev-item-text").text comments.append(comment) # 模拟滚动页面 driver.find_element_by_tag_name("body").send_keys(Keys.END) time.sleep(1) # 判断是否已经滚动到了页面底部 if driver.execute_script("return window.scrollY + window.innerHeight >= document.body.scrollHeight"): break # 打印评论数据 for comment in comments: print(comment) # 关闭浏览器 driver.quit() ``` 这个代码示例使用 Chrome 浏览器打开淘宝商品页面,并且切换到商品评论的 iframe 中。然后模拟滚动页面获取更多评论数据,并通过 Selenium 提取评论文本。最后打印出所有的评论数据。请注意,爬取淘宝评论的行为有可能会违反淘宝的使用协议,建议在爬取前先查看淘宝的使用条款并获取相关的许可。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值