mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2026-03-02 19:17:00 -05:00
New JSInterpreter Features #9237
Closed
opened 2026-02-21 04:59:57 -05:00 by deekerman
·
60 comments
No Branch/Tag specified
master
pull/30733/head
gh-pages
df-fmt-ext-patch
dlp-fifa-backport
df-test-cleanup
pull/29816/head
download-server
totalwebcasting
rtmp_test
2024.07.11-nightly
2021.12.17
2021.06.06
2021.05.16
2021.04.26
2021.04.17
2021.04.07
2021.04.01
2021.03.31
2021.03.25
2021.03.14
2021.03.03
2021.03.02
2021.02.22
2021.02.10
2021.02.04.1
2021.02.04
2021.01.24.1
2021.01.24
2021.01.16
2021.01.08
2021.01.03
2020.12.31
2020.12.29
2020.12.26
2020.12.22
2020.12.14
2020.12.12
2020.12.09
2020.12.07
2020.12.05
2020.12.02
2020.11.29
2020.11.26
2020.11.24
2020.11.21.1
2020.11.21
2020.11.19
2020.11.18
2020.11.17
2020.11.12
2020.11.01.1
2020.11.01
2020.09.20
2020.09.14
2020.09.06
2020.07.28
2020.06.16.1
2020.06.16
2020.06.06
2020.05.29
2020.05.08
2020.05.03
2020.03.24
2020.03.08
2020.03.06
2020.03.01
2020.02.16
2020.01.24
2020.01.15
2020.01.01
2019.12.25
2019.11.28
2019.11.22
2019.11.05
2019.10.29
2019.10.22
2019.10.16
2019.09.28
2019.09.12.1
2019.09.12
2019.09.01
2019.08.13
2019.08.02
2019.07.30
2019.07.27
2019.07.16
2019.07.14
2019.07.12
2019.07.02
2019.06.27
2019.06.21
2019.06.08
2019.05.20
2019.05.11
2019.04.30
2019.04.24
2019.04.17
2019.04.07
2019.04.01
2019.03.18
2019.03.09
2019.03.01
2019.02.18
2019.02.08
2019.01.30.1
2019.01.30
2019.01.27
2019.01.24
2019.01.23
2019.01.17
2019.01.16
2019.01.10
2019.01.02
2018.12.31
2018.12.17
2018.12.09
2018.12.03
2018.11.23
2018.11.18
2018.11.07
2018.11.03
2018.10.29
2018.10.05
2018.09.26
2018.09.18
2018.09.10
2018.09.08
2018.09.01
2018.08.28
2018.08.22
2018.08.04
2018.07.29
2018.07.21
2018.07.10
2018.07.04
2018.06.25
2018.06.19
2018.06.18
2018.06.14
2018.06.11
2018.06.04
2018.06.02
2018.05.30
2018.05.26
2018.05.18
2018.05.09
2018.05.01
2018.04.25
2018.04.16
2018.04.09
2018.04.03
2018.03.26.1
2018.03.26
2018.03.20
2018.03.14
2018.03.10
2018.03.03
2018.02.26
2018.02.25
2018.02.22
2018.02.11
2018.02.08
2018.02.04
2018.02.03
2018.01.27
2018.01.21
2018.01.18
2018.01.14
2018.01.07
2017.12.31
2017.12.28
2017.12.23
2017.12.14
2017.12.10
2017.12.02
2017.11.26
2017.11.15
2017.11.06
2017.10.29
2017.10.20
2017.10.15.1
2017.10.15
2017.10.12
2017.10.07
2017.10.01
2017.09.24
2017.09.15
2017.09.11
2017.09.10
2017.09.02
2017.08.27.1
2017.08.27
2017.08.23
2017.08.18
2017.08.13
2017.08.09
2017.08.06
2017.07.30.1
2017.07.23
2017.07.15
2017.07.09
2017.07.02
2017.06.25
2017.06.23
2017.06.18
2017.06.12
2017.06.05
2017.05.29
2017.05.26
2017.05.23
2017.05.18.1
2017.05.18
2017.05.14
2017.05.09
2017.05.07
2017.05.01
2017.04.28
2017.04.26
2017.04.17
2017.04.16
2017.04.15
2017.04.14
2017.04.11
2017.04.09
2017.04.03
2017.04.02
2017.03.26
2017.03.24
2017.03.22
2017.03.20
2017.03.16
2017.03.15
2017.03.10
2017.03.07
2017.03.06
2017.03.05
2017.03.02
2017.02.28
2017.02.27
2017.02.24.1
2017.02.24
2017.02.22
2017.02.21
2017.02.17
2017.02.16
2017.02.14
2017.02.11
2017.02.10
2017.02.07
2017.02.04.1
2017.02.04
2017.02.01
2017.01.31
2017.01.29
2017.01.28
2017.01.25
2017.01.24
2017.01.22
2017.01.18
2017.01.16
2017.01.14
2017.01.10
2017.01.08
2017.01.05
2017.01.02
2016.12.31
2016.12.22
2016.12.20
2016.12.18
2016.12.15
2016.12.12
2016.12.09
2016.12.01
2016.11.27
2016.11.22
2016.11.18
2016.11.14.1
2016.11.14
2016.11.08.1
2016.11.08
2016.11.04
2016.11.02
2016.10.31
2016.10.30
2016.10.26
2016.10.25
2016.10.21.1
2016.10.21
2016.10.19
2016.10.16
2016.10.12
2016.10.07
2016.10.02
2016.09.27
2016.09.24
2016.09.19
2016.09.18
2016.09.15
2016.09.11.1
2016.09.11
2016.09.08
2016.09.04.1
2016.09.04
2016.09.03
2016.08.31
2016.08.28
2016.08.24.1
2016.08.24
2016.08.22
2016.08.19
2016.08.17
2016.08.13
2016.08.12
2016.08.10
2016.08.07
2016.08.06
2016.08.01
2016.07.30
2016.07.28
2016.07.26.2
2016.07.26.1
2016.07.26
2016.07.24
2016.07.22
2016.07.17
2016.07.16
2016.07.13
2016.07.11
2016.07.09.2
2016.07.09.1
2016.07.09
2016.07.07
2016.07.06
2016.07.05
2016.07.03.1
2016.07.03
2016.07.02
2016.07.01
2016.06.30
2016.06.27
2016.06.26
2016.06.25
2016.06.23.1
2016.06.23
2016.06.22
2016.06.20
2016.06.19.1
2016.06.19
2016.06.18.1
2016.06.18
2016.06.16
2016.06.14
2016.06.12
2016.06.11.3
2016.06.11.2
2016.06.11.1
2016.06.11
2016.06.05
2016.06.04
2016.06.03_tmp
2016.06.03
2016.06.02
2016.05.30.2
2016.05.30.1
2016.05.30
2016.05.21.2
2016.05.21.1
2016.05.21
2016.05.16
2016.05.10
2016.05.01
2016.04.24
2016.04.19
2016.04.13
2016.04.06
2016.04.05
2016.04.01
2016.03.27
2016.03.26
2016.03.25
2016.03.18
2016.03.14
2016.03.06
2016.03.01
2016.02.27
2016.02.22
2016.02.13
2016.02.10
2016.02.09.1
2016.02.09
2016.02.05.1
2016.02.05
2016.02.04
2016.02.01
2016.01.31
2016.01.29
2016.01.27
2016.01.23
2016.01.15
2016.01.14
2016.01.09
2016.01.01
2015.12.31
2015.12.29
2015.12.23
2015.12.21
2015.12.18
2015.12.13
2015.12.10
2015.12.09
2015.12.06
2015.12.05
2015.11.27.1
2015.11.27
2015.11.24
2015.11.23
2015.11.21
2015.11.19
2015.11.18
2015.11.15
2015.11.13
2015.11.10
2015.11.02
2015.11.01
2015.10.24
2015.10.23
2015.10.18
2015.10.16
2015.10.13
2015.10.12
2015.10.09
2015.10.06.2
2015.10.06.1
2015.10.06
2015.09.28
2015.09.22
2015.09.09
2015.09.03
2015.08.28
2015.08.23
2015.08.16.1
2015.08.16
2015.08.09
2015.08.06.1
2015.08.06
2015.07.28
2015.07.21
2015.07.18
2015.07.07
2015.07.04
2015.06.25
2015.06.15
2015.06.04.1
2015.06.04
2015.05.29
2015.05.20
2015.05.15
2015.05.10
2015.05.04
2015.05.03
2015.04.28
2015.04.26
2015.04.17
2015.04.09
2015.04.03
2015.03.28
2015.03.24
2015.03.18
2015.03.15
2015.03.09
2015.03.03.1
2015.03.03
2015.02.28
2015.02.26.2
2015.02.26.1
2015.02.26
2015.02.24.2
2015.02.24.1
2015.02.24
2015.02.23.1
2015.02.23
2015.02.21
2015.02.20
2015.02.19.3
2015.02.19.2
2015.02.19.1
2015.02.19
2015.02.18.1
2015.02.18
2015.02.17.2
2015.02.17.1
2015.02.17
2015.02.16.1
2015.02.16
2015.02.11
2015.02.10.5
2015.02.10.4
2015.02.10.3
2015.02.10.2
2015.02.10.1
2015.02.10
2015.02.09.3
2015.02.09.2
2015.02.09.1
2015.02.09
2015.02.08
2015.02.06
2015.02.04
2015.02.03.1
2015.02.03
2015.02.02.5
2015.02.02.4
2015.02.02.3
2015.02.02.2
2015.02.02.1
2015.02.02
2015.02.01
2015.01.30.2
2015.01.30.1
2015.01.30
2015.01.25
2015.01.23.4
2015.01.23.3
2015.01.23.2
2015.01.23.1
2015.01.23
2015.01.22
2015.01.16
2015.01.15.1
2015.01.15
2015.01.11
2015.01.10.2
2015.01.10.1
2015.01.10
2015.01.09.2
2015.01.09.1
2015.01.09
2015.01.08
2015.01.07.2
2015.01.07.1
2015.01.07
2015.01.05.1
2015.01.05
2015.01.04
2015.01.03
2015.01.02
2015.01.01
2014.12.17.2
2014.12.17.1
2014.12.17
2014.12.16.2
2014.12.16.1
2014.12.16
2014.12.15
2014.12.14
2014.12.13.1
2014.12.13
2014.12.12.7
2014.12.12.6
2014.12.12.5
2014.12.12.4
2014.12.12.3
2014.12.12.2
2014.12.12.1
2014.12.12
2014.12.11
2014.12.10.3
2014.12.10.2
2014.12.10.1
2014.12.10
2014.12.06.1
2014.12.06
2014.12.04.2
2014.12.04.1
2014.12.04
2014.12.03
2014.12.01
2014.11.27
2014.11.26.4
2014.11.26.3
2014.11.26.2
2014.11.26.1
2014.11.26
2014.11.25.1
2014.11.25
2014.11.24
2014.11.23.1
2014.11.23
2014.11.21.1
2014.11.21
2014.11.20.1
2014.11.20
2014.11.16
2014.11.15.1
2014.11.15
2014.11.14
2014.11.13.3
2014.11.13.2
2014.11.13.1
2014.11.13
2014.11.12.1
2014.11.12
2014.11.09
2014.11.04
2014.11.02.1
2014.11.02
2014.10.30
2014.10.29
2014.10.27
2014.10.26.2
2014.10.26.1
2014.10.26
2014.10.25
2014.10.24
2014.10.23
2014.10.18
2014.10.15
2014.10.13
2014.10.12
2014.10.05.2
2014.10.05.1
2014.10.05
2014.10.02
2014.09.29.2
2014.09.29.1
2014.09.29
2014.09.28.1
2014.09.28
2014.09.25
2014.09.24.1
2014.09.24
2014.09.22.1
2014.09.22
2014.09.19
2014.09.18
2014.09.16.1
2014.09.16
2014.09.15.1
2014.09.15
2014.09.14.3
2014.09.14.2
2014.09.14.1
2014.09.14
2014.09.12
2014.09.10.1
2014.09.10
2014.09.06
2014.09.04.3
2014.09.04.2
2014.09.04.1
2014.09.04
2014.09.01.2
2014.09.01.1
2014.09.01
2014.08.29
2014.08.28.2
2014.08.28.1
2014.08.28
2014.08.27.1
2014.08.27
2014.08.26
2014.08.25.3
2014.08.25.2
2014.08.25.1
2014.08.25
2014.08.24.6
2014.08.24.5
2014.08.24.4
2014.08.24.3
2014.08.24.2
2014.08.24.1
2014.08.24
2014.08.23
2014.08.22.3
2014.08.22.2
2014.08.22.1
2014.08.22
2014.08.21.3
2014.08.21.2
2014.08.21.1
2014.08.21
2014.08.10
2014.08.05
2014.08.02.1
2014.08.02
2014.07.30
2014.07.25.1
2014.07.25
2014.07.24
2014.07.23.2
2014.07.23.1
2014.07.23
2014.07.22
2014.07.21
2014.07.20.2
2014.07.20.1
2014.07.20
2014.07.15
2014.07.11.3
2014.07.11.2
2014.07.11.1
2014.07.11
2014.07.10
2014.06.26
2014.06.25
2014.06.24.1
2014.06.24
2014.06.19
2014.06.16
2014.06.09
2014.06.07
2014.06.04
2014.06.02
2014.05.31.4
2014.05.31.3
2014.05.31.2
2014.05.31.1
2014.05.31
2014.05.30.1
2014.05.30
2014.05.19
2014.05.17
2014.05.16.1
2014.05.16
2014.05.13
2014.05.12
2014.05.05
2014.04.30.1
2014.04.30
2014.04.21.6
2014.04.21.5
2014.04.21.4
2014.04.21.3
2014.04.21.2
2014.04.21.1
2014.04.21
2014.04.19
2014.04.13
2014.04.11.2
2014.04.11.1
2014.04.11
2014.04.07.4
2014.04.07.3
2014.04.07.2
2014.04.07.1
2014.04.07
2014.04.04.7
2014.04.04.6
2014.04.04.5
2014.04.04.4
2014.04.04.2
2014.04.04.3
2014.04.04.1
2014.04.04
2014.04.03.3
2014.04.03.2
2014.04.03.1
2014.04.03
2014.04.02
2014.04.01.3
2014.04.01.2
2014.04.01.1
2014.04.01
2014.03.30.1
2014.03.30
2014.03.29
2014.03.28
2014.03.27.1
2014.03.27
2014.03.25.1
2014.03.25
2014.03.24.5
2014.03.24.4
2014.03.24.3
2014.03.24.2
2014.03.24.1
2014.03.24
2013.03.24.2
2013.03.24.1
2013.03.24
2014.03.23
2014.03.21.5
2014.03.21.4
2014.03.21.3
2014.03.21.2
2014.03.21.1
2014.03.21
2014.03.20
2014.03.18.1
2014.03.18
2014.03.17
2014.03.12
2014.03.11
2014.03.10
2014.03.07.1
2014.03.07
2014.03.06
2014.03.04.2
2014.03.04.1
2014.03.04
2014.03.03
2014.02.28
2014.02.27.1
2014.02.27
2014.02.26
2014.02.25.1
2014.02.25
2014.02.24
2014.02.22.1
2014.02.22
2014.02.21.1
2014.02.21
2014.02.20
2014.02.19.1
2014.02.19
2014.02.17
2014.02.13
2014.02.10
2014.02.08.2
2014.02.08.1
2014.02.08
2014.02.06.3
2014.02.06.2
2014.02.06.1
2014.02.06
2014.02.05
2014.02.04.1
2014.02.04
2014.02.03.1
2014.02.03
2014.01.30.2
2014.01.30.1
2014.01.30
2014.01.29
2014.01.28.1
2014.01.28
2014.01.27.2
2014.01.27.1
2014.01.27
2014.01.23.4
2014.01.23.3
2014.01.23.2
2014.01.23.1
2014.01.23
2014.01.22.5
2014.01.22.4
2014.01.22.3
2014.01.22.2
2014.01.22.1
2014.01.22
2014.01.21.1
2014.01.21
2014.01.20
2014.01.17.2
2013.01.17.1
2013.01.17
2014.01.08
2014.01.07.5
2014.01.07.4
2014.01.07.3
2014.01.07.2
2014.01.07.1
2014.01.07
2014.01.06.1
2014.01.06
2014.01.05.6
2014.01.05.5
2014.01.05.4
2014.01.05.3
2014.01.05.1
2014.01.05
2014.01.03
2013.12.26
2013.12.23.4
2013.12.23.3
2013.12.23.2
2013.12.23.1
2013.12.23
2013.12.20
2013.12.17.2
2013.12.17.1
2013.12.17
2013.12.16.7
2013.12.16.6
2013.12.16.5
2013.12.16.4
2013.12.16.3
2013.12.16.2
2013.12.16.1
2013.12.16
2013.12.11.2
2013.12.11.1
2013.12.11
2013.12.10
2013.12.09.4
2013.12.09.3
2013.12.09.2
2013.12.09.1
2013.12.09
2013.12.08.1
2013.12.08
2013.12.04
2013.12.03
2013.12.02
2013.11.29
2013.11.28.1
2013.11.28
2013.11.26
2013.11.25.3
2013.11.25.2
2013.11.25.1
2013.11.25
2013.11.24.1
2013.11.24
2013.11.22.2
2013.11.22.1
2013.11.22
2013.11.21
2013.11.20
2013.11.19
2013.11.18.1
2013.11.18
2013.11.17
2013.11.15.1
2013.11.15
2013.11.13
2013.11.11
2013.11.07
2013.11.06.1
2013.11.06
2013.11.03
2013.11.02
2013.10.30
2013.10.29
2013.10.28
2013.10.23.2
2013.10.23.1
2013.10.23
2013.10.22
2013.10.18.2
2013.10.18.1
2013.10.18
2013.10.17
2013.10.15
2013.10.09
2013.10.07
2013.10.06
2013.10.04
2013.10.01.1
2013.10.01
2013.09.29
2013.09.24.2
2013.09.24.1
2013.09.24
2013.09.20.1
2013.09.20
2013.09.17
2013.09.16
2013.09.12
2013.11.09
2013.09.10
2013.09.07
2013.09.06.1
2013.09.06
2013.09.05
2013.09.04
2013.08.30
2013.08.29
2013.08.28.1
2013.08.28
2013.08.27
2013.08.23
2013.08.22
2013.08.21
2013.08.17
2013.08.15
2013.08.14
2013.08.09
2013.08.08.1
2013.08.08
2013.08.02
2013.07.31
2013.07.25.2
2013.07.25.1
2013.07.25
2013.07.24.2
2013.07.24.1
2013.07.24
2013.07.23.1
2013.07.23
2013.07.19
2013.07.18
2013.07.17.1
2013.07.17
2013.07.12
2013.07.11
2013.07.10
2013.07.08.1
2013.07.08
2013.07.07.01
2013.07.07
2013.07.05
2013.07.04
2013.07.02
2013.06.34.4
2013.06.34.3
2013.06.34.2
2013.06.34.1
2013.06.34
2013.06.33
2013.06.32
2013.06.31
2013.06.30
2013.06.29
2013.06.28
2013.06.27
2013.06.26
2013.06.25
2013.06.23
2013.06.21
2013.05.23
2013.05.14
2013.05.13
2013.05.10
2013.05.07
2013.05.06
2013.05.05
2013.05.04
2013.05.01
2013.04.31
2013.04.30
2013.04.28
2013.04.27
2013.04.22
2013.04.21
2013.04.18
2013.04.11
2013.04.03
2013.03.29
2013.02.25
2013.02.22
2012.02.22
2013.02.19
2013.02.18
2013.02.02
2013.02.01
2013.01.28
2013.01.27
2013.01.13
2013.01.12
2012.12.99
2013.01.11
2013.01.08
2013.01.06
2013.01.02
2012.12.11
2012.11.29
2012.11.28
2012.11.27
2012.11.17
2012.10.09
2012.09.27
2012.02.27
2012.02.26
2012.01.08b
2012.01.08
2012.01.05
2011.12.18
2011.12.15
2011.12.08
2011.11.23
2011.11.22
2011.11.21
2011.10.19
2011.09.30
2011.09.27
2011.09.18c
2011.09.18b
2011.09.18
2011.09.17
2011.09.16
2011.09.15
2011.09.14
2011.09.13
2011.08.04
2011.03.29
2011.02.25c
2011.02.25b
2011.02.25
2011.01.30
2010.12.09
2010.11.19
2010.10.24
2010.10.03
2010.08.04
2010.07.24
2010.07.22
2010.07.14
2010.06.06
2010.04.04
2010.04.03
2010.04.02
2010.03.13
2010.03.07
2010.02.13
2010.01.19
2010.01.06
2010.01.05
2009.12.26
2009.09.13
2009.09.08
2009.08.08
2009.06.29
2009.05.30
2009.05.25
2009.05.23
2009.05.13
2009.05.11
2009.04.25
2009.04.06
2009.03.28
2009.03.03
2009.02.07
2009.01.31
2008.11.01
2008.10.16
2008.09.20
2008.08.09
2008.07.22
Labels
Clear labels
DRM
Good first issue
account-needed
broken-IE
bug
build/update
cant-reproduce
clarification-needed
documentation
duplicate
external-bugs
fixed
geo-restricted
gh-pages
help-wanted
hls
incomplete
invalid
linux
mpd
not-a-bug
nsfw
offtopic
out-of-scope
outdated-version
patch-available
pending-fixes
php
postprocessors
question
regression
request
request
site-support-request
site-update-request
spam
subtitles
test-needed
tv-provider-account-needed
windows
won't fix
yt-dlp
No labels
DRM
Good first issue
account-needed
broken-IE
bug
build/update
cant-reproduce
clarification-needed
documentation
duplicate
external-bugs
fixed
geo-restricted
gh-pages
help-wanted
hls
incomplete
invalid
linux
mpd
not-a-bug
nsfw
offtopic
out-of-scope
outdated-version
patch-available
pending-fixes
php
postprocessors
question
regression
request
request
site-support-request
site-update-request
spam
subtitles
test-needed
tv-provider-account-needed
windows
won't fix
yt-dlp
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
starred/youtube-dl-ytdl-org#9237
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sulyi on GitHub (Nov 24, 2016).
Please follow the guide below
xinto all the boxes [ ] relevant to your issue (like that [x])Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2016.11.22. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
Description of your issue, suggested solution and other information
I think JSInterpreter has rather limited features. I've started to implement some new ones at #11272.
To do so I'm using a syntax grammar and actual parsing.
I wouldn't mind some feed back, help and testcases or just merely have a discussion about it.
@yan12125 commented on GitHub (Nov 25, 2016):
Actual parsing is complicated as Javascript is not a good language (neither is Python lol) Is there a need?
Personally I'm against such changes as that sounds like re-inventing wheels
@sulyi commented on GitHub (Nov 25, 2016):
Yes there is a need. I'd like to do it.
When you say wheel are you referring to jaspyon or pynarcissus?
I think building an interpreter from scratch has it's own benefits and really not that complicated.
--- edit ---
I'm rather worried how efficient it can be made. With some clever solutions it'll be ok hopefully.
@yan12125 commented on GitHub (Nov 26, 2016):
No. I was referring to SpiderMonkey of Gecko, V8 of Blink, JavascriptCore of Webkit and ChakraCore of IE/Edge, and maybe other JS engines used in popular browsers.
Could you give some concrete examples (website, etc.). I'm not sure what should be concerned in #11272. Without limited targets, I'll review it as a real complete JS engine.
Well, at least obfuscated codes like https://github.com/rg3/youtube-dl/issues/8489#issuecomment-190315378 (from openload) and iqiyi's login SDK should be supported:
@sulyi commented on GitHub (Nov 26, 2016):
I'll need to look into your suggestions, @yan12125, more carefully, but I don't think any of the engines you mentioned is written in py.
Jaspyon can be found at https://bitbucket.org/santagada/jaspyon/ and pynarcissus at https://github.com/jtolds/pynarcissus, these are the JavaScript interpreters in py that I found.
As the scope I'd say at first I'd aim to support all the code supported right now. That should be plenty to see how it goes. And a good base to build on and widen the support if it succeeds. My ultimate goal is indeed a complete JS engine, but saying out loud that does sound a bit overly ambitious at the moment.
@yan12125 commented on GitHub (Nov 26, 2016):
Yes they are implemented with C/C++/Objective-C. If your goal is a complete JS engine, they are excellent choices. Python wrappers for those existing engines are much easier to write and maintain in comparison with a new Python implementation from scratch. Could you share the idea for why a pure Python implementation is necessary?
@sulyi commented on GitHub (Nov 26, 2016):
At the end of the day, it's up to the maintainers to decide if this is able to serve their needs or not.
As far as platform independence goes it's better not having native code or third party modules.
Implementing an JavaScript interpreter seams rather a whole lot of fun/challenge/practice/good reference...
Also why not?
@yan12125 commented on GitHub (Nov 26, 2016):
@siddht1 What @sulyi wants is a Javascript interpreter in youtube-dl that handles scrips on web pages, not youtube downloaders written in Javascript. They are different.
That depends. If there are already excellent solutions for a complex task, few people will re-implement them beyond the scope of toy projects. If you need a library not in your target language, a binding/wrapper is the most common way. For example, HTTP and TLS protocols are easy, so there are python-requests and python-tls. On the other hand, GUI systems are complex, so there are PyQt, PyGTK, and CPython's builtin tkinter module, but I have never seen a GUI toolkit in pure Python. At first
JSInterpreteris implemented for handling signature decryption functions on YouTube, which are naive Javascript codes. As it's simple, a pure Python implementation is the best choice. On the other hand, bridging existing JS engines is better if you need all Javascript features, in terms of development and maintaining difficulty as well as performance.Changes in youtube-dl should solve real problems. Of course it's fun, but this is not the place.
I have no plan to reject your pull request. I'm asking your goal so that I can determine whether a pull request is ready or not. As you've said, your goal is a complete JS engine, so you can continue your work. When it's almost done (for example pass most of Spidermonkey's test suite), we can come back and start reviewing it.
@siddht4 commented on GitHub (Nov 27, 2016):
@yan that's great by the way , i just suggested different approach of the fix . I would be ready to help if required , engine for mozilla is not gecko anymore , the engine could be written in node js as it support nAtive apps too.
@sulyi commented on GitHub (Nov 27, 2016):
Thanks, @siddht1 it was actually helpful. After studying narcissus and other engines, and reading the specs I've realized I can't continue without first designing this. So after doing that right now I need to tear almost everything down and redo it. Hopefully it'll go faster second time.
--- edit ---
Basic concept:
The tokens of lexical grammar will be a dictionary of regular expression strings, the production of syntactic grammar will be described by another dictionary containing lists of token ids. The lexer would use both dictionaries compile the actual regex used to match tokens, and return them by statements as a list. Than the parser would use the second dictionary to decide how should be these tokens interpreted according to the syntactic grammar.
@siddht4 commented on GitHub (Nov 28, 2016):
@yan @sulyi i am unable to view my first comment. if you have it kindly repost it or atleast mail me
@sulyi commented on GitHub (Nov 28, 2016):
@siddht1 Sry, neither can I.
@mozbugbox commented on GitHub (Nov 28, 2016):
Js2Py is another option which claims to support ECMA 5
@yan12125 commented on GitHub (Nov 28, 2016):
Js2Py looks so far so good. The only two issues I found:
pyimportseems a way but I'd like cleaner approaches. It's better to have for PAC support (#8278)@siddht4 commented on GitHub (Nov 28, 2016):
`
Js2Py is another option which claims to support ECMA 5
Js2Py looks so far so good. The only two issues I found:
`
according to me this is just the part of the puzzle , maybe an engine should be develop first similar to creating cobbler in java.
js2py lacks many components but other similar project can help to lessen the gap.
what everbody fails to see is that the flow will break
youtube-dl -----> in js engine -------> out js engine -----> site
site ----> js engine (fails to parse if gets inbound , where it`s suppose to get outbound)
fix
youtube-dl <-----> js engine #1 (inbound) <----------------------------- site (Send)
| /
| /
-------> js engine #2- (outbound)----> site (GET) /
@siddht4 commented on GitHub (Nov 28, 2016):
sorry the diagram didnt came out as expected , wait this is what i wanted to suggest
@sulyi commented on GitHub (Nov 28, 2016):
Funny thing, starting this I's hoping to discuss how to do this not why I shouldn't. Yes, existing solutions can be very help full, but only to a certain point. Right now I need to implement the parser, using the tokens. Yet, I might do some further minor changes on the lexer first, e.g. reserved words can get their collective token id since value and id would be an injective relation otherwise. Hopefully after I start working on the parser it'll start to show some promising signs.
@sulyi commented on GitHub (Nov 30, 2016):
Can some one enlighten me what this means in the specs:
Is this just trying to say that parentheses are resolved? Because I couldn't find any clue to that.
@yan12125 commented on GitHub (Nov 30, 2016):
Did you mean section 11.14? That describes the order of evaluation of expressions involving a comma operator.
@sulyi commented on GitHub (Nov 30, 2016):
Yes, among others, like VariableDeclarationNoIn and RelationalExpressionNoIn, later has an even more confusing note:
@yan12125 commented on GitHub (Nov 30, 2016):
I guess NoIn variants are for simpler grammars - you don't need to peek so many tokens when building a lookahead LL parser.
@sulyi commented on GitHub (Dec 3, 2016):
I'm thinking shunting-yard algorithm for assignment/conditional expression just to simply reduce number of methods. Looking at other interpreters' source it seams ast is preferred. I'd love to hear pros and cons.
@yan12125 commented on GitHub (Dec 3, 2016):
That sounds fine. The only concern is error reporting for invalid expressions. In youtube-dl it's OK to assume all inputs are valid.
@sulyi commented on GitHub (Dec 3, 2016):
Grouping will still be handled by expression and conditional expression also will have it's own token. Therefore error handling can be done properly, in my opinion.
Having implemented it, I think it's kinda' the same, only difference is that shunting-yard uses a local operator stack instead the callstack. Interpretation might have to be a little bit different, tho. At the current state that's broken and I'm a bit nervous about it, but it's getting there.
@sulyi commented on GitHub (Dec 3, 2016):
Another thing, I'm thinking about refactoring. A separate grammar/tstream module would be nice in it's own package, like:
and in
__init__.py:I believe that would be backward compatible too.
@yan12125 commented on GitHub (Dec 4, 2016):
Refactoring is the way to go. But is there a need to expose TokenStream? I thought it's used internally in JSInterpreter only.
@sulyi commented on GitHub (Dec 4, 2016):
Sure, that's a valid question I haven't think I got an answer to. My thoughts were, that one might want to have a tokenizer for the grammar.
Other thing I was thinking is error handling. I don't see it as a single function, therefore I don't know how to not do it. If that makes any sense.
Anyway, might worth discussing more how error-reporting should happen.
@sulyi commented on GitHub (Dec 5, 2016):
As a partial parser in place there's only the interpreter left to implement in order to get to the milestone I've mentioned before. I might still under estimate the complexity of the remaining work, but I've started thinking about testing and adding dynamically SpiderMonkey's test to the testcases.
@yan12125 commented on GitHub (Dec 5, 2016):
Thanks for that! Could you add some more tests first? Now #11272 is big enough and I guess it's fragile to refactoring.
@sulyi commented on GitHub (Dec 6, 2016):
Probably it could be made much more robust by introducing a Token and/or an ASTree class.
There were some testcases (e.g. instantiation, from top of my head), I was wondering, while implementing things, how it would perform against. I would love some suggestions, thou.
There's quite some TODO before it passes the current testcases, I've just wanted to put out the idea of dynamic testcases. I'm not sure how to do it, but I hope reading the SpiderMonkey documentation will help.
@sulyi commented on GitHub (Dec 8, 2016):
I've just added parser test. Subsequently got stuck with interpreter and as result made a mess.
I'm thinking a Reference helper class and a context stack for JSInterpreter would be helpful.
Reference._parent would be either local_vars (top-level) or array or object literal and Reference._key would be identifier, index, and property or method name respectably.
Instead of storing values they would store Reference instances.
@siddht4 commented on GitHub (Dec 8, 2016):
Can you make a new repo so that others including me can help you
@yan12125 commented on GitHub (Dec 8, 2016):
There are lots of js files in https://hg.mozilla.org/mozilla-central/file/tip/js/src/tests/ecma_5. At the stage of parsing, I guess it's enough if you feed them into
JSInterpreterand the parser doesn't crash. There are no reference outputs for those tests, and I don't think there's anybody willing to do such a tedious work to give out a correct answer for each Mozilla's test case.The idea of Reference sounds fine. Just be careful with closures.
@sulyi commented on GitHub (Dec 8, 2016):
@siddht1 I've forked youtube-dl, so actually there is a repo, I guess you should need to fork that.
@yan12125 I'll check those tests out, maybe find a way to feed them to an another existing parser or something. I definitely won't do them by hand ty, I think had done enough to be able to carry on.
Anything in particular in mind I should be look out for with closures? Do you think a
hasattr(self._parent, '__setitem__')andhasattr(self._parent, '__delitem__')check in__init__would suffice?After posting the previous one I've come up with some improvements.
@yan12125 commented on GitHub (Dec 8, 2016):
A possiblilty is hacking Spidermonkey and dump its parsed tree. #jspi channel on Mozilla's IRC may help.
@sulyi commented on GitHub (Dec 10, 2016):
Any idea how to get comparing zip objects work in python3 (in a nested list by uinttest)?
[...]/test_jsinterp_parser.py#L106
[...]/test_jsinterp_parser.py#L170
[...]/test_jsinterp_parser.py#L310
[...]/test_jsinterp_parser.py#L371
...
@yan12125 commented on GitHub (Dec 10, 2016):
Is there anything wrong in python3's zip?
@sulyi commented on GitHub (Dec 10, 2016):
Solved it, kinda! With traverse. Yet, it's still a generator.
I'm not very keen on
type(o) == zipcheck, thou.@yan12125 commented on GitHub (Dec 10, 2016):
I see. As performance is not critical in tests, you may want to just transform everything into
lists.@sulyi commented on GitHub (Dec 10, 2016):
I think that'd have issue with
operatorsand generators still get empty Even withitertools.tee.@yan12125 commented on GitHub (Dec 10, 2016):
Oops. Just ignore my previous comment
@sulyi commented on GitHub (Dec 10, 2016):
copy.deepcopyis the only way to compare a generator twice, without converting it tolistbefore hand.I think I like that a lot.
@sulyi commented on GitHub (Dec 10, 2016):
For getting SpiderMonkey tests can I use hglib package?It seams that it's for local repos. More over hg does not support narrow clone. I think a small spider needs to be implemented to ad these tests dynamically.-- edit --
Looking at the test, those does not seam very well applicable.
@yan12125 commented on GitHub (Dec 10, 2016):
Do you want to clone the whole mozilla-central source tree? Please don't do that. There's no need to keep up-to-date with Firefox (For example it's going to support ES2017 while there's no need to support it in youtube-dl now.), so just copy files is fine.
@sulyi commented on GitHub (Dec 10, 2016):
No, I definitely don't want to clone the whole mozilla-central. So, you say I shouldn't add anything dynamically? Just cherry-pick some of them and dump them in test_jsinterp_parser?
@yan12125 commented on GitHub (Dec 10, 2016):
IIRC unlike SVN, mercurial does not allow cloning partial files. What youtube-dl needs are those tests. If you know a way to sync only those test files, go ahead. Note that extra dependencies should affect only tests/, not youtube_dl/
@sulyi commented on GitHub (Dec 10, 2016):
How about a linux native spider like
curlor wget?-- edit --
This seams to work fine:
wget -np -r -e robots=off --accept='*.js' https://hg.mozilla.org/mozilla-central/file/tip/js/src/tests/ecma_5/Adding a
-ndeven dumps it in a single directory but there's alot ofshell.jsandbrowser.js(due to their testing framework) those get an extra number extension in their names.@yan12125 commented on GitHub (Dec 10, 2016):
I guess you want to download Mozilla's test suite each time test_jsinterp invoked? I don't think it's a good idea as there are thousands of files.
@sulyi commented on GitHub (Dec 10, 2016):
I don't know. I'd much rather extract some useful test from the testcases and run those through unittest, but I don't think I can do that. The only other option I see is to add tests to existing ones manually based on mozilla's tests.
@yan12125 commented on GitHub (Dec 10, 2016):
Oops I should leave this comment here: https://github.com/rg3/youtube-dl/pull/11272#issuecomment-266220412
@sulyi commented on GitHub (Dec 10, 2016):
Dumping a list of links to mozilla testcases in a file on building tests might also be a good practice.
@yan12125 commented on GitHub (Dec 10, 2016):
As long as it does not take too long time, it fine.
@sulyi commented on GitHub (Dec 10, 2016):
I've
timeit thewgetcrawl at home:@yan12125 commented on GitHub (Dec 10, 2016):
Does it take 16 minutes every time when running
python test/test_jsinterp.pyor there's a local copy and it's necessary only when syncing tests from Mozilla?@sulyi commented on GitHub (Dec 10, 2016):
If anybody is interested I'd like to share some side product, I've created while studying the specs.
These are the grammar I've extracted in EBNF notation and some syntax diagrams created by http://www.bottlecaps.de/rr/ui from it.
Can't attach them for some reason, so:
https://gist.github.com/sulyi/15674f4802503d81711b015a05faae46
@sulyi commented on GitHub (Dec 11, 2016):
I'm wondering what @phihag thinks about this.
@sulyi commented on GitHub (Dec 15, 2016):
I've reworked the test suite. It does not support adding tests from any other suites, but hopefully it's pretty straight forward adding new ones and use them to test either or both interpretation and parsing.
If anybody planing on adding new tests to help out which would be nice, please check it out or make a better one, just also integrate the current ones.
@sulyi commented on GitHub (Dec 17, 2016):
I'm a little bit stuck with designing built-ins.
@yan12125 commented on GitHub (Dec 18, 2016):
In the parsing stage I guess built-ins are not different than other things?
@sulyi commented on GitHub (Dec 19, 2016):
Sry, haven't seen your post, till now and I also needed a break from it to rehash a bit.
I've passed parsing. Parsing is done. Might need some loving later, minor features and possible refracting into it's own class (and module).
I've redone the test suite in order to be able to run tests of parsing an interpreting flexibly on the same script codes, because I had to move on implementing the interpreter at the first place. Otherwise it would have got ugly fast if I hadn't sorted that out, before starting to work on that.
As the built-ins I've been thinking and I'll probably keep the
Referenceclass and use it as a "wrapping", and recreate the inheritance tree of javascript objects in a separate module and use those as values. There might be a need for adictto lookup JS properties in each class, but first I'll try to do it usinghasattror__dict__.I've started working on function calls, but I think the context stack is not working properly. Doing
updateonglobalswithlocal_varswhencontext_push, and remove the difference oncontext_popmight solve it, but that likely has an issue with shadowing names.@sulyi commented on GitHub (Jan 24, 2017):
It's probably quite mute, yet I have to point out that the fix for #11663 and #11664 committed by @dstftw is a bit baffling to me.
Let's take the following three independent js expressions:
a = 42this.a = 42var a = 42first two are equivalent, the third, beside that it sets the return value to
undefinedwhile the others to42, only differs that the[[Configurable]]internal property ofaisfalseinstead oftrue.The practical consequence of this is, when running
delete ain the first two cases the result istruewhile in the third it'sfalse, but not much else.In all three cases
this.a === aistrue.