avilash / TikTokAPI-Python

TikTok API Python Wrapper
http://avilashkumar.com/TikTokAPI-Python/
MIT License
450 stars 113 forks source link

api.downloadVideoByIdNoWatermark is not working #27

Closed DangoLee closed 3 years ago

DangoLee commented 3 years ago

Hello, I‘m trying to downloadVideoByIdNoWatermark, it returns a html code with error instead.

def downloadVideoByIdNoWatermark(self, video_id, save_path):
    video_info = self.getVideoById(video_id)
    video_url = video_info["itemInfo"]["itemStruct"]["video"]["downloadAddr"]
    video_data = get_req_text(video_url, params=None, headers=self.headers)
    pos = video_data.find("vid:")
    if pos == -1:
        raise VideoException("Video without watermark not available in new videos")
    video_url_no_wm = "https://api2-16-h2.musical.ly/aweme/v1/play/?video_id={" \
                      "}&vr_type=0&is_play_url=1&source=PackSourceEnum_PUBLISH&media_type=4" \
        .format(video_data[pos + 4:pos + 36])
    print("video_url_no_wm : ")
    print(video_url_no_wm)
    video_data_no_wm = get_req_content(video_url_no_wm, params=None, headers=self.headers)
    print("video_data_no_wm : ")
    print(video_data_no_wm)
    with open(save_path, 'wb') as f:
        f.write(video_data_no_wm)

video_id: 6829613641491418374

video_url_no_wm : https://api2-16-h2.musical.ly/aweme/v1/play/?video_id=v09044b80000br3qikhe3ejq8khkj6n0&vr_type=0&is_play_url=1&source=PackSourceEnum_PUBLISH&media_type=4

video_data_no_wm :


b'\nAccess Denied\n\n

Access Denied

\n \nYou don\'t have permission to access "/D/11965/819927/000/api2.musical.ly/c2f7c0a5a85fc47409196837f0d0d4d3/6011a5d1/video/tos/useast2a/tos-useast2a-pve-0068/3cb3c791b9c048caaed792fae13091cc/?a=1233&br=8404&bt=4202&cd=0%7C0%7C0&cr=0&cs=0&cv=1&dr=0&ds=6&er=&l=202101271141260101901760164F090CD3&lr=&mime_type=video_mp4&pl=0&qs=0&rc=MzlubnRoaG50dTMzOzczM0ApaTQzPGU7ZWVnN2g3aWc5OGdrZ2U1ZzBlZjBfLS1fMTZzc18tXjIvYGM1MmIxYl5gX2I6Yw%3D%3D&vl=&vr=" on this server.

\nReference #18.f23ca17.1611747688.193a3168\n\n\n'


avilash commented 3 years ago

The old method to download videos without watermark no longer works, and I'm yet to figure out the new way. As of now you cannot download videos without watermark, using the package. I should have updated it in the Readme

There are websites online which allow you to download without watermark, so there should be a way

DangoLee commented 3 years ago

Thanks for your reply.

flashclub commented 2 years ago

The old method to download videos without watermark no longer works, and I'm yet to figure out the new way. As of now you cannot download videos without watermark, using the package. I should have updated it in the Readme

There are websites online which allow you to download without watermark, so there should be a way

Hi, thank you very much for writing this open source project. I was very excited when I first found this project, I simply used the method downloadVideoById and it made it easy to download the video, then I saw that the video had a watermark on it, so I tried again with downloadVideoByIdNoWatermark and it reported an error, then I turned to this issue. considering your previous reply was January 2021, are there any plans to perfect the watermark-free downloads now? In any case, thank you very much.