Giter Site home page Giter Site logo

so-cool / myslideslive Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 4.0 221 KB

Extract your SlidesLive presentation.

Home Page: https://so-cool.github.io/myslideslive

License: BSD 3-Clause "New" or "Revised" License

Python 27.68% Jupyter Notebook 72.32%

myslideslive's People

Contributors

so-cool avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

myslideslive's Issues

"JSON Decode" error

Hi,

I'm having trouble running this code. When in terminal I run e.g.

msl --slide 1074 1075
https://slideslive.com/38956531/beyond-static-papers-rethinking-how-we-share-scientific-understanding-in-ml

, the slides don't download and I get the following error message:

Traceback (most recent call last):
File "/Users/yuan/opt/anaconda3/bin/msl", line 8, in
sys.exit(main())
File "/Users/yuan/opt/anaconda3/lib/python3.8/site-packages/myslideslive/cli.py", line 83, in main
msl = SlidesLive(url)
File "/Users/yuan/opt/anaconda3/lib/python3.8/site-packages/myslideslive/slideslive.py", line 500, in init
self.video_description = get_sl_info(self.video_id)
File "/Users/yuan/opt/anaconda3/lib/python3.8/site-packages/myslideslive/slideslive.py", line 69, in get_sl_info
info_json = json.loads(info_request.content.decode())
File "/Users/yuan/opt/anaconda3/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/Users/yuan/opt/anaconda3/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/yuan/opt/anaconda3/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Error: Cannot process this XML structure: {xml_root.tag}

mySlidesLive can't download slides from 2022 and later, it seems. When I run msl --slide 2 3 https://slideslive.com/38988636/24-sparsity-on-gpu-tensor-cores, no download occurs and I get the following output:

Traceback (most recent call last):
  File "/opt/homebrew/bin/msl", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/myslideslive/cli.py", line 83, in main
    msl = SlidesLive(url)
          ^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/myslideslive/slideslive.py", line 556, in __init__
    meta = get_slide_metadata(
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/myslideslive/slideslive.py", line 153, in get_slide_metadata
    meta_data_ = parse_slide_xml(meta_content)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/myslideslive/slideslive.py", line 118, in parse_slide_xml
    raise RuntimeError(f'Cannot process this XML structure: {xml_root.tag}.')
RuntimeError: Cannot process this XML structure: Error.

The presentation https://slideslive.com/39004359/optimal-transport-in-learning-control-and-dynamical-systems also yields the same issue.

Connect Error

Traceback (most recent call last):
File "/home/wanghaochen/anaconda3/envs/video_doc/lib/python3.9/site-packages/urllib3/connectionpool.py", line 776, in urlopen
self._prepare_proxy(conn)
File "/home/wanghaochen/anaconda3/envs/video_doc/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1041, in _prepare_proxy
conn.connect()
File "/home/wanghaochen/anaconda3/envs/video_doc/lib/python3.9/site-packages/urllib3/connection.py", line 642, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "/home/wanghaochen/anaconda3/envs/video_doc/lib/python3.9/site-packages/urllib3/connection.py", line 783, in ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
File "/home/wanghaochen/anaconda3/envs/video_doc/lib/python3.9/site-packages/urllib3/util/ssl
.py", line 469, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "/home/wanghaochen/anaconda3/envs/video_doc/lib/python3.9/site-packages/urllib3/util/ssl
.py", line 513, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/home/wanghaochen/anaconda3/envs/video_doc/lib/python3.9/ssl.py", line 501, in wrap_socket
return self.sslsocket_class._create(
File "/home/wanghaochen/anaconda3/envs/video_doc/lib/python3.9/ssl.py", line 1074, in _create
self.do_handshake()
File "/home/wanghaochen/anaconda3/envs/video_doc/lib/python3.9/ssl.py", line 1343, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer
How to fix it, I change the header and proxy

AssertionError: 3 elements constitute a single frame

Thank you for your excellent work. But when I run the script below, some error occurs.

from myslideslive import SlidesLive

msl = SlidesLive('https://slideslive.com/39014617/direct-preference-optimization-your-language-model-is-secretly-a-reward-model')
msl.download_slides(slide=(1074, 1075))
msl.compose_video()

Bug Info:

----> 5 msl.compose_video()

File c:\Users\xxx\miniconda3\envs\agent\lib\site-packages\myslideslive\slideslive.py:687, in SlidesLive.compose_video(self, video_file, slide_folder, last_duration, slide, time)
    682     self.slides_dir = self.video_id
    684 ffmpeg_script, self.start_time, self.end_time = self.get_ffmpeg_script(
    685     slide_folder=self.slides_dir, last_duration=last_duration,
    686     slide=slide, time=time)
--> 687 compose_ffmpeg_video(ffmpeg_script, video_file=self.slides_video)
    689 print(f'\n\nExtracted time segment in seconds:\n    {self.start_time}--{self.end_time}')

File c:\Users\xxx\miniconda3\envs\agent\lib\site-packages\myslideslive\slideslive.py:522, in compose_ffmpeg_video(ffmpeg_script, video_file)
    519     raise RuntimeError(f'{video_file} video file already exists.')
    521 ffmpeg_script_list = ffmpeg_script.split('\n')
--> 522 assert len(ffmpeg_script_list) > 2, '3 elements constitute a single frame'
    523 if len(ffmpeg_script_list) == 3:
    524     img = ffmpeg_script_list[0]

AssertionError: 3 elements constitute a single frame

KeyError: 'image'

I am trying to download this video URL: https://slideslive.com/39007973/zahajeni-digisemestru

But I get error:

Traceback (most recent call last):
  File "D:\Videos\DigiSemestr\download_slides.py", line 4, in <module>
    msl.download_slides(slide=(1, 43))
  File "D:\Videos\DigiSemestr\digisemestr\Lib\site-packages\myslideslive\slideslive.py", line 634, in download_slides
    url_list = self.get_slide_urls(slide_type=slide_type,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Videos\DigiSemestr\digisemestr\Lib\site-packages\myslideslive\slideslive.py", line 622, in get_slide_urls
    return get_urls(self.video_id, self.video_metadata,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Videos\DigiSemestr\digisemestr\Lib\site-packages\myslideslive\slideslive.py", line 222, in get_urls
    slide_id=s['image']['name'],
             ~^^^^^^^^^
KeyError: 'image'

Handle video slides

SlidesLive allows for video slides (e.g., see here from #14). Version 0.7 offers a workaround by replacing video slides with static images, but this feature needs to be implemented.

For inspiration, look at yt-dlp, which is able to download these slides.

yt-dlp --skip-download https://slideslive.com/39007973/zahajeni-digisemestru
yt-dlp -J https://slideslive.com/39007973/zahajeni-digisemestru

Also, consider adding an alternative CDN:

https://slides.slideslive.com/{video_id}/slides/original/{slide_id}.{format}

Key problem in SlidesLive.py

I tried the given example but it throws the following error:

File "slideslive.py", line 494, in __init__
    self.video_description['slides_xml_url'], approach='xml')
KeyError: 'slides_xml_url'

Any help is appreciated.

Permission denied - ffmpeg

When I am trying to use this great library, I get an error. Even when I run it with "sudo" in Powershell.

Error

-vsync is deprecated. Use -fps_mode
[in#0 @ 000001fbe283d100] Error opening input: Permission denied
Error opening input file C:\Users\pegak\AppData\Local\Temp\tmpffh6dbvd.
Error opening input files: Permission denied

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.