首页 > 其他分享 >莫莫铺子数据爬取

莫莫铺子数据爬取

时间:2024-04-22 22:36:09浏览次数:24  
标签:function return 莫莫 爬取 length var 铺子 concat

1. python部分

莫莫铺子.py

# -*- coding:utf-8 -*-

# @Time : 2024/4/15 23:12
# @Author : 快乐的小猴子
# @Version :
# @Function :
import subprocess
from functools import partial
subprocess.Popen = partial(subprocess.Popen, encoding='utf-8')
import requests
import execjs


url = 'https://openapi.dataoke.com/api/goods/get-goods-list'
headers=  {
    "Accept": "application/json, text/plain, */*",
    "Accept-Encoding": "gzip, deflate, br",
    "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
    "Cache-Control": "no-cache",
    "Host": "openapi.dataoke.com",
    "Origin": "http://mmpz.ttzhuijuba.com",
    "Pragma": "no-cache",
    "Referer": "http://mmpz.ttzhuijuba.com/",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "cross-site",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
    "sec-ch-ua": "\"Chromium\";v=\"116\", \"Not)A;Brand\";v=\"24\", \"Google Chrome\";v=\"116\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\""
}
params = {
    "version": "v1.2.4",
    "appKey": "612bcfe884763",
    "pageId": 1,
    "pageSize": 100,
    "sort": "0",
    "cids": "1",
    "tmall": 1,
    "commissionRateLowerLimit": 2,
    "hasCoupon": 1,
    "keyWords": ""
}
with open("./莫莫铺子.js", "r", encoding="utf-8") as f:
    js = f.read()
ctx = execjs.compile(js)
sign = ctx.call("getSign", params, "5dd20b08158402032845b45f5b67a349")
params["sign"] = sign
response = requests.get(url, headers=headers, params=params)
print(response.json())

莫莫铺子.js

var window = {};

!function(n) {
    "use strict";
    function t(n, t) {
        var r = (65535 & n) + (65535 & t)
          , e = (n >> 16) + (t >> 16) + (r >> 16);
        return e << 16 | 65535 & r
    }
    function r(n, t) {
        return n << t | n >>> 32 - t
    }
    function e(n, e, u, o, c, f) {
        return t(r(t(t(e, n), t(o, f)), c), u)
    }
    function u(n, t, r, u, o, c, f) {
        return e(t & r | ~t & u, n, t, o, c, f)
    }
    function o(n, t, r, u, o, c, f) {
        return e(t & u | r & ~u, n, t, o, c, f)
    }
    function c(n, t, r, u, o, c, f) {
        return e(t ^ r ^ u, n, t, o, c, f)
    }
    function f(n, t, r, u, o, c, f) {
        return e(r ^ (t | ~u), n, t, o, c, f)
    }
    function i(n, r) {
        n[r >> 5] |= 128 << r % 32,
        n[(r + 64 >>> 9 << 4) + 14] = r;
        var e, i, a, h, d, g = 1732584193, l = -271733879, v = -1732584194, C = 271733878;
        for (e = 0; e < n.length; e += 16)
            i = g,
            a = l,
            h = v,
            d = C,
            g = u(g, l, v, C, n[e], 7, -680876936),
            C = u(C, g, l, v, n[e + 1], 12, -389564586),
            v = u(v, C, g, l, n[e + 2], 17, 606105819),
            l = u(l, v, C, g, n[e + 3], 22, -1044525330),
            g = u(g, l, v, C, n[e + 4], 7, -176418897),
            C = u(C, g, l, v, n[e + 5], 12, 1200080426),
            v = u(v, C, g, l, n[e + 6], 17, -1473231341),
            l = u(l, v, C, g, n[e + 7], 22, -45705983),
            g = u(g, l, v, C, n[e + 8], 7, 1770035416),
            C = u(C, g, l, v, n[e + 9], 12, -1958414417),
            v = u(v, C, g, l, n[e + 10], 17, -42063),
            l = u(l, v, C, g, n[e + 11], 22, -1990404162),
            g = u(g, l, v, C, n[e + 12], 7, 1804603682),
            C = u(C, g, l, v, n[e + 13], 12, -40341101),
            v = u(v, C, g, l, n[e + 14], 17, -1502002290),
            l = u(l, v, C, g, n[e + 15], 22, 1236535329),
            g = o(g, l, v, C, n[e + 1], 5, -165796510),
            C = o(C, g, l, v, n[e + 6], 9, -1069501632),
            v = o(v, C, g, l, n[e + 11], 14, 643717713),
            l = o(l, v, C, g, n[e], 20, -373897302),
            g = o(g, l, v, C, n[e + 5], 5, -701558691),
            C = o(C, g, l, v, n[e + 10], 9, 38016083),
            v = o(v, C, g, l, n[e + 15], 14, -660478335),
            l = o(l, v, C, g, n[e + 4], 20, -405537848),
            g = o(g, l, v, C, n[e + 9], 5, 568446438),
            C = o(C, g, l, v, n[e + 14], 9, -1019803690),
            v = o(v, C, g, l, n[e + 3], 14, -187363961),
            l = o(l, v, C, g, n[e + 8], 20, 1163531501),
            g = o(g, l, v, C, n[e + 13], 5, -1444681467),
            C = o(C, g, l, v, n[e + 2], 9, -51403784),
            v = o(v, C, g, l, n[e + 7], 14, 1735328473),
            l = o(l, v, C, g, n[e + 12], 20, -1926607734),
            g = c(g, l, v, C, n[e + 5], 4, -378558),
            C = c(C, g, l, v, n[e + 8], 11, -2022574463),
            v = c(v, C, g, l, n[e + 11], 16, 1839030562),
            l = c(l, v, C, g, n[e + 14], 23, -35309556),
            g = c(g, l, v, C, n[e + 1], 4, -1530992060),
            C = c(C, g, l, v, n[e + 4], 11, 1272893353),
            v = c(v, C, g, l, n[e + 7], 16, -155497632),
            l = c(l, v, C, g, n[e + 10], 23, -1094730640),
            g = c(g, l, v, C, n[e + 13], 4, 681279174),
            C = c(C, g, l, v, n[e], 11, -358537222),
            v = c(v, C, g, l, n[e + 3], 16, -722521979),
            l = c(l, v, C, g, n[e + 6], 23, 76029189),
            g = c(g, l, v, C, n[e + 9], 4, -640364487),
            C = c(C, g, l, v, n[e + 12], 11, -421815835),
            v = c(v, C, g, l, n[e + 15], 16, 530742520),
            l = c(l, v, C, g, n[e + 2], 23, -995338651),
            g = f(g, l, v, C, n[e], 6, -198630844),
            C = f(C, g, l, v, n[e + 7], 10, 1126891415),
            v = f(v, C, g, l, n[e + 14], 15, -1416354905),
            l = f(l, v, C, g, n[e + 5], 21, -57434055),
            g = f(g, l, v, C, n[e + 12], 6, 1700485571),
            C = f(C, g, l, v, n[e + 3], 10, -1894986606),
            v = f(v, C, g, l, n[e + 10], 15, -1051523),
            l = f(l, v, C, g, n[e + 1], 21, -2054922799),
            g = f(g, l, v, C, n[e + 8], 6, 1873313359),
            C = f(C, g, l, v, n[e + 15], 10, -30611744),
            v = f(v, C, g, l, n[e + 6], 15, -1560198380),
            l = f(l, v, C, g, n[e + 13], 21, 1309151649),
            g = f(g, l, v, C, n[e + 4], 6, -145523070),
            C = f(C, g, l, v, n[e + 11], 10, -1120210379),
            v = f(v, C, g, l, n[e + 2], 15, 718787259),
            l = f(l, v, C, g, n[e + 9], 21, -343485551),
            g = t(g, i),
            l = t(l, a),
            v = t(v, h),
            C = t(C, d);
        return [g, l, v, C]
    }
    function a(n) {
        var t, r = "";
        for (t = 0; t < 32 * n.length; t += 8)
            r += String.fromCharCode(255 & n[t >> 5] >>> t % 32);
        return r
    }
    function h(n) {
        var t, r = [];
        for (r[(n.length >> 2) - 1] = void 0,
        t = 0; t < r.length; t += 1)
            r[t] = 0;
        for (t = 0; t < 8 * n.length; t += 8)
            r[t >> 5] |= (255 & n.charCodeAt(t / 8)) << t % 32;
        return r
    }
    function d(n) {
        return a(i(h(n), 8 * n.length))
    }
    function g(n, t) {
        var r, e, u = h(n), o = [], c = [];
        for (o[15] = c[15] = void 0,
        u.length > 16 && (u = i(u, 8 * n.length)),
        r = 0; 16 > r; r += 1)
            o[r] = 909522486 ^ u[r],
            c[r] = 1549556828 ^ u[r];
        return e = i(o.concat(h(t)), 512 + 8 * t.length),
        a(i(c.concat(e), 640))
    }
    function l(n) {
        var t, r, e = "0123456789abcdef", u = "";
        for (r = 0; r < n.length; r += 1)
            t = n.charCodeAt(r),
            u += e.charAt(15 & t >>> 4) + e.charAt(15 & t);
        return u
    }
    function v(n) {
        return unescape(encodeURIComponent(n))
    }
    function C(n) {
        return d(v(n))
    }
    function m(n) {
        return l(C(n))
    }
    function s(n, t) {
        return g(v(n), v(t))
    }
    function A(n, t) {
        return l(s(n, t))
    }
    function p(n, t, r) {
        return t ? r ? s(t, n) : A(t, n) : r ? C(n) : m(n)
    }
    "function" == typeof define && define.amd ? define(function() {
        return p
    }) : n.md5 = p
}(window);


function getSign(t, e) {
    var n = ""
      , r = 0
      , a = [];
    for (var i in t)
        //  i一定在t里  t[i]可能为空   如果t[i] == 0
        //  我还是push  如果t[i] = ""  那就不管了
        (t[i] || 0 == t[i]) && a.push("".concat(i, "=").concat(t[i]));
    for (var o in a.sort(),
    a)
        n = "".concat(n).concat(0 === r ? "" : "&").concat(a[o]),
        r++;
    var c = window.md5("".concat(n, "&key=").concat(e));
    return c
}


t = {
    "version": "v1.2.4",
    "appKey": "612bcfe884763",
    "pageId": 1,
    "pageSize": 100,
    "sort": "0",
    "cids": "1",
    "tmall": 1,
    "commissionRateLowerLimit": 2,
    "hasCoupon": 1,
    "keyWords": ""
}
var e = "5dd20b08158402032845b45f5b67a349"
// console.log(getSign(t,e))

执行结果截图:
image

标签:function,return,莫莫,爬取,length,var,铺子,concat
From: https://www.cnblogs.com/zczhaod/p/18136984

相关文章

  • 海南免税商城数据爬取(破解滑块验证码)
    1.python部分main.py#-*-coding:utf-8-*-#@Time:2024/4/1521:24#@Author:快乐的小猴子#@Version:#@Function:importsubprocessfromfunctoolsimportpartial#专门用来固定参数的subprocess.Popen=partial(subprocess.Popen,encoding="utf-8")im......
  • 爬虫爬取网站
    1.建数据库product表和product_data表CREATETABLEproduct(idINTAUTO_INCREMENTPRIMARYKEY,nameVARCHAR(255)NOTNULL,urlVARCHAR(255)NOTNULL);CREATETABLEproduct_data(idINTAUTO_INCREMENTPRIMARYKEY,product_idINT,pr......
  • 建设库数据爬取
    1.python部分:#-*-coding:utf-8-*-#@Time:2024/4/1417:57#@Author:快乐的小猴子#@Version:#@Function:importrequestsimportjsonimportsubprocessfromfunctoolsimportpartial#专门用来固定参数的subprocess.Popen=partial(subprocess.Pop......
  • 喜马拉雅节目爬取
    1.python部分:喜马拉雅.py#-*-coding:utf-8-*-#@Time:2024/4/149:47#@Author:快乐的小猴子#@Version:#@Function:爬取喜马拉雅节目数据importrequestsimportsubprocessfromfunctoolsimportpartial#专门用来固定参数的subprocess.Popen=parti......
  • 基于python数据爬取和可视化
    系统介绍本系统介绍了一个基于基于Python的电影数据爬取和可视化技术的研究和方案设计,采用Python语言和Django架构构建。通过网络爬虫爬取豆瓣电影评论数据,利用数据清洗和处理技术,建立了一个全面的电影信息数据库。使用Python中强大的数据处理库进行统计分析,常见的一些库panda......
  • 实战7_公众号爬取方式
    获取某公众号下面的所有文章一.分析公众号登录公众号首页-图文消息-超链接点开后再选择其他公众号并输入要搜索的公众号名,点击搜索出的公众号,下面便会显示公众号下的文章名二.获取链接两次请求1.获取公众号请求token值是变化的fakeid是下次请求要用到的数据2.获......
  • python爬取京东商品信息与可视化
    项目介绍:使用python爬取京东电商拿到价格、店铺、链接、销量并做可视化...........................................................................................................................................................项目介绍效果展示全部代码..............
  • C语言高效的网络爬虫:实现对新闻网站的全面爬取
    1.背景搜狐是一个拥有丰富新闻内容的网站,我们希望能够通过网络爬虫系统,将其各类新闻内容进行全面地获取和分析。为了实现这一目标,我们将采用C语言编写网络爬虫程序,通过该程序实现对news.sohu.com的自动化访问和数据提取。2.网络爬虫系统设计2.1网络请求与响应处理......
  • 通过selenium框架爬取图片
    通过selenium框架爬取图片环境搭建搭建python环境就不在此展开了,首先安装selenium框架:pipinstallselenium下载浏览器驱动,此处仅仅以Chrome浏览器为例子,驱动版本必须与当前系统安装的Chrome对应。chromedriver下载,如果找不到对应版本,是因为版本太新,需要到此链接找到......
  • scrapy框架之CrawlSpider全站爬取
    一、什么是全站爬取全站爬取(CrawltheEntireSite)是指通过网络爬虫程序遍历并获取一个网站上的所有页面或资源的过程。这种爬取方式旨在获取网站的全部内容,包括文本、图片、视频、链接等,以建立网站的完整内容索引或进行数据分析。二、全栈爬取介绍1、全站数据爬取的方式(1)通过......