Giter VIP home page Giter VIP logo

Comments (12)

duiaic avatar duiaic commented on July 17, 2024 1

from video_spider.

duiaic avatar duiaic commented on July 17, 2024

抖音解析失败,更换Cookie无效,复制所有Cookie后解析视频皆为视频已被删除

有没有可能 这个视频本来就删除了。

from video_spider.

nroyliu avatar nroyliu commented on July 17, 2024

抖音解析失败,更换Cookie无效,复制所有Cookie后解析视频皆为视频已被删除

有没有可能 这个视频本来就删除了。

那肯定不是啊 测试不都是现找视频吗 而且又不是只测试一两个

from video_spider.

327078466 avatar 327078466 commented on July 17, 2024

解决了吗? 我换了cookie 和ttwid 都不行

from video_spider.

GodCodeApps avatar GodCodeApps commented on July 17, 2024

from video_spider.

GodCodeApps avatar GodCodeApps commented on July 17, 2024

from video_spider.

5ime avatar 5ime commented on July 17, 2024

目前自用代码如下,Cookie 内容为网页版登陆后内容,准确来说为登陆后的 ttwid #102 #104 #100 #101

public static function douyin($url)
    {
        $loc = get_headers($url, true)['Location'];
        preg_match('/[0-9]+/', $loc, $id);
        if (empty($id)) {
            preg_match('/[0-9]+/', $url, $id);
        }

        $url = 'http://127.0.0.1:1234/';
        $header = array('Content-Type: application/json');
        $data = json_encode(array('url' => 'https://www.douyin.com/aweme/v1/web/aweme/detail/?aweme_id=' . $id[0] . '&aid=1128&version_name=23.5.0&device_platform=android&os_version=2333','userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'));
        $arr =json_decode(Common::getCurl($url, $data, $header), true);
        $url = $arr['data']['url'];
        $header = array('User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36', 'Referer: https://www.douyin.com/', 'Cookie: msToken='.Common::msToken(107).';' . self::$douyinCookie);

        $arr = json_decode(Common::getCurl($url, null, $header), true);
        $video_url = $arr['aweme_detail']['video']['play_addr']['url_list'][0];

        if (empty($video_url)) {
            $arr = array('code' => 201, 'msg' => '解析失败');
            return $arr;
        }

        $arr = array(
            'code' => 200,
            'msg' => 'success',
            'data' => array(
                'title' => $arr['aweme_detail']['desc'],
                'author' => $arr['aweme_detail']['author']['nickname'],
                'avatar' => $arr['aweme_detail']['music']['avatar_large']['url_list'][0],
                'like' => $arr['aweme_detail']['statistics']['digg_count'],
                'time' => $arr['aweme_detail']['create_time'],
                'cover' => $arr['aweme_detail']['video']['origin_cover']['url_list'][0],
                'url' => $arr['aweme_detail']['video']['play_addr']['url_list'][0],
                'music' => array(
                    'author' => $arr['aweme_detail']['music']['author'],
                    'avatar' => $arr['aweme_detail']['music']['cover_large']['url_list'][0],
                    'url' => $arr['aweme_detail']['music']['play_url']['url_list'][0],
                )
            )
        ); 
        return $arr;
    }

from video_spider.

mqllin avatar mqllin commented on July 17, 2024

目前自用代码如下,Cookie 内容为网页版登陆后内容,准确来说为登陆后的 ttwid #102 #104 #100 #101

public static function douyin($url)
    {
        $loc = get_headers($url, true)['Location'];
        preg_match('/[0-9]+/', $loc, $id);
        if (empty($id)) {
            preg_match('/[0-9]+/', $url, $id);
        }

        $url = 'http://127.0.0.1:1234/';
        $header = array('Content-Type: application/json');
        $data = json_encode(array('url' => 'https://www.douyin.com/aweme/v1/web/aweme/detail/?aweme_id=' . $id[0] . '&aid=1128&version_name=23.5.0&device_platform=android&os_version=2333','userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'));
        $arr =json_decode(Common::getCurl($url, $data, $header), true);
        $url = $arr['data']['url'];
        $header = array('User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36', 'Referer: https://www.douyin.com/', 'Cookie: msToken='.Common::msToken(107).';' . self::$douyinCookie);

        $arr = json_decode(Common::getCurl($url, null, $header), true);
        $video_url = $arr['aweme_detail']['video']['play_addr']['url_list'][0];

        if (empty($video_url)) {
            $arr = array('code' => 201, 'msg' => '解析失败');
            return $arr;
        }

        $arr = array(
            'code' => 200,
            'msg' => 'success',
            'data' => array(
                'title' => $arr['aweme_detail']['desc'],
                'author' => $arr['aweme_detail']['author']['nickname'],
                'avatar' => $arr['aweme_detail']['music']['avatar_large']['url_list'][0],
                'like' => $arr['aweme_detail']['statistics']['digg_count'],
                'time' => $arr['aweme_detail']['create_time'],
                'cover' => $arr['aweme_detail']['video']['origin_cover']['url_list'][0],
                'url' => $arr['aweme_detail']['video']['play_addr']['url_list'][0],
                'music' => array(
                    'author' => $arr['aweme_detail']['music']['author'],
                    'avatar' => $arr['aweme_detail']['music']['cover_large']['url_list'][0],
                    'url' => $arr['aweme_detail']['music']['play_url']['url_list'][0],
                )
            )
        ); 
        return $arr;
    }

请问 $url = 'http://127.0.0.1:1234/';是什么服务

from video_spider.

327078466 avatar 327078466 commented on July 17, 2024

java 需要最新代码联系我

from video_spider.

duiaic avatar duiaic commented on July 17, 2024

from video_spider.

327078466 avatar 327078466 commented on July 17, 2024

https://github.com/327078466/jd_maotai 有联系方式哦

from video_spider.

sysdefault avatar sysdefault commented on July 17, 2024

目前自用代码如下,Cookie 内容为网页版登陆后内容,准确来说为登陆后的 ttwid #102 #104 #100 #101

public static function douyin($url)
    {
        $loc = get_headers($url, true)['Location'];
        preg_match('/[0-9]+/', $loc, $id);
        if (empty($id)) {
            preg_match('/[0-9]+/', $url, $id);
        }

        $url = 'http://127.0.0.1:1234/';
        $header = array('Content-Type: application/json');
        $data = json_encode(array('url' => 'https://www.douyin.com/aweme/v1/web/aweme/detail/?aweme_id=' . $id[0] . '&aid=1128&version_name=23.5.0&device_platform=android&os_version=2333','userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'));
        $arr =json_decode(Common::getCurl($url, $data, $header), true);
        $url = $arr['data']['url'];
        $header = array('User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36', 'Referer: https://www.douyin.com/', 'Cookie: msToken='.Common::msToken(107).';' . self::$douyinCookie);

        $arr = json_decode(Common::getCurl($url, null, $header), true);
        $video_url = $arr['aweme_detail']['video']['play_addr']['url_list'][0];

        if (empty($video_url)) {
            $arr = array('code' => 201, 'msg' => '解析失败');
            return $arr;
        }

        $arr = array(
            'code' => 200,
            'msg' => 'success',
            'data' => array(
                'title' => $arr['aweme_detail']['desc'],
                'author' => $arr['aweme_detail']['author']['nickname'],
                'avatar' => $arr['aweme_detail']['music']['avatar_large']['url_list'][0],
                'like' => $arr['aweme_detail']['statistics']['digg_count'],
                'time' => $arr['aweme_detail']['create_time'],
                'cover' => $arr['aweme_detail']['video']['origin_cover']['url_list'][0],
                'url' => $arr['aweme_detail']['video']['play_addr']['url_list'][0],
                'music' => array(
                    'author' => $arr['aweme_detail']['music']['author'],
                    'avatar' => $arr['aweme_detail']['music']['cover_large']['url_list'][0],
                    'url' => $arr['aweme_detail']['music']['play_url']['url_list'][0],
                )
            )
        ); 
        return $arr;
    }

请教一下,用了一阵子没问题,今天用时发现返回为空了,抖音又改了吗

url = "https://www.douyin.com/aweme/v1/web/aweme/detail/?" + query + "&X-Bogus=" + x_bogus
headers = {
    'User-Agent': user_agent,
    'Referer': 'https://www.douyin.com/',
    'Cookie': f'msToken={ms_token}; ttwid={ttwid}'
}

from video_spider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.