|
89 | 89 | "```\n", |
90 | 90 | "</br>\n", |
91 | 91 | "\n", |
| 92 | + "```python\n", |
| 93 | + "from urllib.request import urlretrieve\n", |
| 94 | + "from urllib.parse import quote\n", |
| 95 | + "proxied_url = 'https://cors-anywhere.herokuapp.com/' + quote(video_url);\n", |
| 96 | + "urlretrieve(proxied_url, fname)\n", |
| 97 | + "```\n", |
| 98 | + "</br>\n", |
| 99 | + "\n", |
92 | 100 | "We assume here that you downloaded the video, and you will read it from its local file name. Check the type, and note that you can get info, like the frames-per-second, using `get_meta_data()`. This function returns a dictionary, so to access one data element you would use the key (for example `'fps'` is the key for the data about frames per second)." |
93 | 101 | ] |
94 | 102 | }, |
|
5358 | 5366 | "\n", |
5359 | 5367 | "3. _Elementary Mechanics Using Python_ (2015), Anders Malthe-Sorenssen, Undergraduate Lecture Notes in Physics, Springer. Data at https://folk.universitetetioslo.no/malthe/mechbook/fallingtennisball02.d" |
5360 | 5368 | ] |
5361 | | - }, |
5362 | | - { |
5363 | | - "cell_type": "code", |
5364 | | - "execution_count": 1, |
5365 | | - "metadata": {}, |
5366 | | - "outputs": [ |
5367 | | - { |
5368 | | - "data": { |
5369 | | - "text/html": [ |
5370 | | - "<style>\n", |
5371 | | - "\n", |
5372 | | - "@font-face {\n", |
5373 | | - " font-family: 'et-book';\n", |
5374 | | - " src: url('https://cdnjs.cloudflare.com/ajax/libs/tufte-css/1.8.0/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff') format('woff2'),\n", |
5375 | | - " url('https://cdnjs.cloudflare.com/ajax/libs/tufte-css/1.8.0/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff') format('woff');\n", |
5376 | | - " font-weight: normal;\n", |
5377 | | - " font-style: normal;\n", |
5378 | | - "}\n", |
5379 | | - "@font-face {\n", |
5380 | | - " font-family: 'et-book';\n", |
5381 | | - " src: url('https://cdnjs.cloudflare.com/ajax/libs/tufte-css/1.8.0/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff') format('woff');\n", |
5382 | | - " font-weight: normal;\n", |
5383 | | - " font-style: italic;\n", |
5384 | | - "}\n", |
5385 | | - "@font-face {\n", |
5386 | | - " font-family: 'et-book';\n", |
5387 | | - " src: url('https://cdnjs.cloudflare.com/ajax/libs/tufte-css/1.8.0/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff') format('woff');\n", |
5388 | | - " font-weight: bold;\n", |
5389 | | - " font-style: normal;\n", |
5390 | | - "}\n", |
5391 | | - "/* The various ET-Book fonts are on GitHub at: https://github.com/edwardtufte/et-book\n", |
5392 | | - "*/\n", |
5393 | | - "@font-face{\n", |
5394 | | - " font-family: 'Source Code Pro';\n", |
5395 | | - " font-weight: 400;\n", |
5396 | | - " font-style: normal;\n", |
5397 | | - " font-stretch: normal;\n", |
5398 | | - " src: url('https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/WOFF2/OTF/SourceCodePro-Regular.otf.woff2') format('woff2'),\n", |
5399 | | - " url('https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/WOFF/OTF/SourceCodePro-Regular.otf.woff') format('woff'),\n", |
5400 | | - " url('https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Regular.otf') format('opentype');\n", |
5401 | | - "}\n", |
5402 | | - "\n", |
5403 | | - "@font-face{\n", |
5404 | | - " font-family: 'Source Sans';\n", |
5405 | | - " font-weight: 400;\n", |
5406 | | - " font-style: normal;\n", |
5407 | | - " font-stretch: normal;\n", |
5408 | | - " src: url('https://raw.githubusercontent.com/adobe-fonts/source-sans/release/WOFF2/OTF/SourceSans3-Regular.otf.woff2') format('woff2'),\n", |
5409 | | - " url('https://raw.githubusercontent.com/adobe-fonts/source-sans/release/WOFF/OTF/SourceSans3-Regular.otf.woff') format('woff'),\n", |
5410 | | - " url('https://raw.githubusercontent.com/adobe-fonts/source-sans/release/OTF/SourceSans3-Regular.otf') format('opentype');\n", |
5411 | | - "}\n", |
5412 | | - "@font-face {\n", |
5413 | | - " font-family: \"Computer Modern\";\n", |
5414 | | - " src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');\n", |
5415 | | - "}\n", |
5416 | | - "\n", |
5417 | | - ":root {\n", |
5418 | | - " --jp-content-line-height: 1.3;\n", |
5419 | | - " --jp-content-font-scale-factor: 1.2;\n", |
5420 | | - " --jp-content-font-size1: 20px; /* Base font size */\n", |
5421 | | - " --jp-content-font-family: 'et-book', 'Palatino Linotype', Palatino, serif;\n", |
5422 | | - "} \n", |
5423 | | - "\n", |
5424 | | - ".jp-RenderedHTMLCommon {\n", |
5425 | | - " line-height: 1.3 !important;\n", |
5426 | | - " font-size: 20px !important;\n", |
5427 | | - " font-family: 'et-book', 'Palatino Linotype', Palatino, serif;\n", |
5428 | | - " padding-left: 10% !important;\n", |
5429 | | - " padding-right: 20% !important;\n", |
5430 | | - "}\n", |
5431 | | - "\n", |
5432 | | - ".jp-CodeCell {\n", |
5433 | | - " padding-left: 10% !important;\n", |
5434 | | - " padding-right: 20% !important;\n", |
5435 | | - "}\n", |
5436 | | - "\n", |
5437 | | - ".jp-RawCell {\n", |
5438 | | - " padding-left: 10% !important;\n", |
5439 | | - " padding-right: 20% !important;\n", |
5440 | | - "}\n", |
5441 | | - "\n", |
5442 | | - "\n", |
5443 | | - "code {\n", |
5444 | | - " font-size: 0.8em !important;\n", |
5445 | | - " background-color: #f0f0f0 !important;\n", |
5446 | | - "}\n", |
5447 | | - "\n", |
5448 | | - "hr {\n", |
5449 | | - " background: #000;\n", |
5450 | | - " height: 1px;\n", |
5451 | | - " border: 0px;\n", |
5452 | | - "} \n", |
5453 | | - "\n", |
5454 | | - "\n", |
5455 | | - "#notebook_panel { /* main background */\n", |
5456 | | - " background: rgb(245,245,245);\n", |
5457 | | - "}\n", |
5458 | | - "\n", |
5459 | | - "div.cell { /* set cell width */\n", |
5460 | | - " width: 800px;\n", |
5461 | | - "}\n", |
5462 | | - "\n", |
5463 | | - "div #notebook { /* centre the content */\n", |
5464 | | - " background: #fff; /* white background for content */\n", |
5465 | | - " width: 800px;\n", |
5466 | | - " margin: auto;\n", |
5467 | | - " padding-left: 0em;\n", |
5468 | | - "}\n", |
5469 | | - "\n", |
5470 | | - "#notebook li { /* More space between bullet points */\n", |
5471 | | - "margin-top:0.5em;\n", |
5472 | | - "}\n", |
5473 | | - "\n", |
5474 | | - "/* draw border around running cells */\n", |
5475 | | - "div.cell.border-box-sizing.code_cell.running { \n", |
5476 | | - " border: 1px solid #111;\n", |
5477 | | - "}\n", |
5478 | | - "\n", |
5479 | | - "/* Put a solid color box around each cell and its output, visually linking them*/\n", |
5480 | | - "div.cell.code_cell {\n", |
5481 | | - " background-color: rgb(256,256,256); \n", |
5482 | | - " border-radius: 0px; \n", |
5483 | | - " padding: 0.5em;\n", |
5484 | | - " margin-left:1em;\n", |
5485 | | - " margin-top: 1em;\n", |
5486 | | - "}\n", |
5487 | | - "\n", |
5488 | | - "\n", |
5489 | | - "div.text_cell_render{\n", |
5490 | | - " font-family: 'Source Sans', sans-serif;\n", |
5491 | | - " line-height: 140%;\n", |
5492 | | - " font-size: 100%;\n", |
5493 | | - " width:680px;\n", |
5494 | | - " margin-left:auto;\n", |
5495 | | - " margin-right:auto;\n", |
5496 | | - "}\n", |
5497 | | - "\n", |
5498 | | - "/* Formatting for header cells */\n", |
5499 | | - ".text_cell_render h1 {\n", |
5500 | | - " /* font-family: 'Merriweather', serif; */\n", |
5501 | | - " font-style:regular;\n", |
5502 | | - " font-weight: bold; \n", |
5503 | | - " font-size: 250%;\n", |
5504 | | - " line-height: 100%;\n", |
5505 | | - " color: #004065;\n", |
5506 | | - " margin-bottom: 1em;\n", |
5507 | | - " margin-top: 0.5em;\n", |
5508 | | - " display: block;\n", |
5509 | | - "}\t\n", |
5510 | | - ".text_cell_render h2 {\n", |
5511 | | - " /* font-family: 'Merriweather', serif; */\n", |
5512 | | - " font-weight: bold; \n", |
5513 | | - " font-size: 180%;\n", |
5514 | | - " line-height: 100%;\n", |
5515 | | - " color: #0096d6;\n", |
5516 | | - " margin-bottom: 0.5em;\n", |
5517 | | - " margin-top: 0.5em;\n", |
5518 | | - " display: block;\n", |
5519 | | - "}\t\n", |
5520 | | - "\n", |
5521 | | - ".text_cell_render h3 {\n", |
5522 | | - " /* font-family: 'Merriweather', serif; */\n", |
5523 | | - "\tfont-size: 150%;\n", |
5524 | | - " margin-top:12px;\n", |
5525 | | - " margin-bottom: 3px;\n", |
5526 | | - " font-style: regular;\n", |
5527 | | - " color: #008367;\n", |
5528 | | - "}\n", |
5529 | | - "\n", |
5530 | | - ".text_cell_render h4 { /*Use this for captions*/\n", |
5531 | | - " font-family: 'et-book';\n", |
5532 | | - " font-weight: 300; \n", |
5533 | | - " font-size: 100%;\n", |
5534 | | - " line-height: 120%;\n", |
5535 | | - " text-align: left;\n", |
5536 | | - " width:500px;\n", |
5537 | | - " margin-top: 1em;\n", |
5538 | | - " margin-bottom: 2em;\n", |
5539 | | - " margin-left: 80pt;\n", |
5540 | | - " font-style: italic;\n", |
5541 | | - "}\n", |
5542 | | - "\n", |
5543 | | - ".text_cell_render h5 { /*Use this for small titles*/\n", |
5544 | | - " font-family: 'Source Sans', sans-serif;\n", |
5545 | | - " font-size: 130%;\n", |
5546 | | - " color: #e31937;\n", |
5547 | | - " margin-bottom: .5em;\n", |
5548 | | - " margin-top: 1em;\n", |
5549 | | - " display: block;\n", |
5550 | | - "}\n", |
5551 | | - "\n", |
5552 | | - ".text_cell_render h6 { /*use this for copyright note*/\n", |
5553 | | - " font-family: 'Source Code Pro', sans-serif;\n", |
5554 | | - " font-weight: 300;\n", |
5555 | | - " font-size: 9pt;\n", |
5556 | | - " line-height: 100%;\n", |
5557 | | - " color: grey;\n", |
5558 | | - " margin-bottom: 1px;\n", |
5559 | | - " margin-top: 1px;\n", |
5560 | | - "}\n", |
5561 | | - "\n", |
5562 | | - " .CodeMirror{\n", |
5563 | | - " font-family: \"Source Code Pro\";\n", |
5564 | | - "\t\t\tfont-size: 100%;\n", |
5565 | | - " }\n", |
5566 | | - "/* .prompt{\n", |
5567 | | - " display: None;\n", |
5568 | | - " }*/\n", |
5569 | | - "\t\n", |
5570 | | - " \n", |
5571 | | - " .warning{\n", |
5572 | | - " color: rgb( 240, 20, 20 )\n", |
5573 | | - " } \n", |
5574 | | - "</style>\n", |
5575 | | - "<script>\n", |
5576 | | - " MathJax.Hub.Config({\n", |
5577 | | - " TeX: {\n", |
5578 | | - " extensions: [\"AMSmath.js\"], \n", |
5579 | | - " equationNumbers: { autoNumber: \"AMS\", useLabelIds: true}\n", |
5580 | | - " },\n", |
5581 | | - " tex2jax: {\n", |
5582 | | - " inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n", |
5583 | | - " displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n", |
5584 | | - " },\n", |
5585 | | - " displayAlign: 'center', // Change this to 'center' to center equations.\n", |
5586 | | - " \"HTML-CSS\": {\n", |
5587 | | - " styles: {'.MathJax_Display': {\"margin\": 4}}\n", |
5588 | | - " }\n", |
5589 | | - " });\n", |
5590 | | - "</script>\n" |
5591 | | - ], |
5592 | | - "text/plain": [ |
5593 | | - "<IPython.core.display.HTML object>" |
5594 | | - ] |
5595 | | - }, |
5596 | | - "execution_count": 1, |
5597 | | - "metadata": {}, |
5598 | | - "output_type": "execute_result" |
5599 | | - } |
5600 | | - ], |
5601 | | - "source": [ |
5602 | | - "# Execute this cell to load the notebook's style sheet, then ignore it\n", |
5603 | | - "from IPython.core.display import HTML\n", |
5604 | | - "css_file = '../../../styles/custom.css'\n", |
5605 | | - "HTML(open(css_file, \"r\").read())" |
5606 | | - ] |
5607 | 5369 | } |
5608 | 5370 | ], |
5609 | 5371 | "metadata": { |
|
5622 | 5384 | "name": "python", |
5623 | 5385 | "nbconvert_exporter": "python", |
5624 | 5386 | "pygments_lexer": "ipython3", |
5625 | | - "version": "3.11.9" |
| 5387 | + "version": "3.14.3" |
5626 | 5388 | } |
5627 | 5389 | }, |
5628 | 5390 | "nbformat": 4, |
|
0 commit comments