text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
dictionary if the value of some key | 3,870.16 | 5.04 |
itself is another dictionary so this is | 3,872.799 | 3.76 |
a common paradigm and even though it | 3,875.2 | 3.52 |
might seem a bit cryptic it's just | 3,876.559 | 4 |
something that allows us to associate | 3,878.72 | 4.319 |
more keys with more values now most of | 3,880.559 | 4.081 |
this information i probably don't care | 3,883.039 | 3.601 |
about for instance according to apple | 3,884.64 | 4.159 |
the unique identifier for weezer is | 3,886.64 | 4.28 |
apparently 115 | 3,888.799 | 4.721 |
234. that might be useful if i'm making | 3,890.92 | 4.28 |
my own database and i want this to be | 3,893.52 | 4 |
searchable but for today's purposes all | 3,895.2 | 4.639 |
i care about is the name of the track | 3,897.52 | 5.2 |
otherwise called track name as key and | 3,899.839 | 4.96 |
the first song and only song because we | 3,902.72 | 4.319 |
limited it to one that we got back from | 3,904.799 | 4.32 |
itunes here is the song that you might | 3,907.039 | 5.04 |
know by weezer called say it ain't so | 3,909.119 | 5.92 |
so now i have a bit of a clue if my goal | 3,912.079 | 5.361 |
here is to implement a program called | 3,915.039 | 4.8 |
itunes.pi that doesn't just dump the | 3,917.44 | 3.76 |
response from the server which is | 3,919.839 | 3.681 |
admittedly very cryptic but to print out | 3,921.2 | 5.2 |
all of the songs that itunes has for the | 3,923.52 | 6 |
band called weezer maybe i can iterate | 3,926.4 | 5.439 |
over this somehow so let me backtrack | 3,929.52 | 4.559 |
here's the key called track name | 3,931.839 | 4.641 |
it is inside of a dictionary | 3,934.079 | 5.76 |
that is the value of results here | 3,936.48 | 5.599 |
so how can i go about getting this well | 3,939.839 | 4.321 |
let me go ahead and try this let me go | 3,942.079 | 4.081 |
ahead and shrink my terminal window back | 3,944.16 | 2.879 |
down | 3,946.16 | 2.8 |
and let me propose now for one final | 3,947.039 | 4.08 |
flourish we don't just lazily print out | 3,948.96 | 3.68 |
the contents of that response because | 3,951.119 | 3.041 |
that's not interesting or pretty for | 3,952.64 | 4.56 |
anyone let's do this let me go ahead and | 3,954.16 | 4.879 |
create a new variable just for the sake | 3,957.2 | 4.08 |
of discussion called o for object and | 3,959.039 | 4.241 |
i'm going to go ahead and call | 3,961.28 | 6.24 |
o equals response dot json just to store | 3,963.28 | 6.96 |
that json response specifically in a | 3,967.52 | 4.24 |
variable called o but i could name it | 3,970.24 | 3.44 |
anything i want and now i'm going to do | 3,971.76 | 2.88 |
this | 3,973.68 | 3.04 |
for each result | 3,974.64 | 2.88 |
in | 3,976.72 | 2.319 |
that object's | 3,977.52 | 2.48 |
key | 3,979.039 | 4.32 |
called results go ahead and print out | 3,980 | 6.72 |
that results track name and notice i | 3,983.359 | 4.881 |
have used exactly the same | 3,986.72 | 3.92 |
capitalization track name has a capital | 3,988.24 | 4.64 |
n results is all lowercase and let me | 3,990.64 | 4.56 |
rewind before we run the actual program | 3,992.88 | 4.8 |
in line eight we are making an http | 3,995.2 | 4.639 |
request using python to the server just | 3,997.68 | 4 |
like you and i as humans type urls into | 3,999.839 | 3.681 |
a browser and hit enter this is the | 4,001.68 | 3.76 |
python equivalent thereof | 4,003.52 | 4.96 |
i am then on line 10 just grabbing from | 4,005.44 | 4.879 |
that variable that contains the server's | 4,008.48 | 4.879 |
response the json object that i care | 4,010.319 | 4.641 |
about the thing between those curly | 4,013.359 | 4.401 |
braces at the very top and the bottom | 4,014.96 | 4.639 |
but because we've poked around and | 4,017.76 | 4.079 |
because i read the documentation earlier | 4,019.599 | 5.44 |
i know that that object has a key called | 4,021.839 | 5.601 |
results and that results key again is a | 4,025.039 | 4.08 |
list now at the moment that list | 4,027.44 | 4.56 |
contains only one song say it ain't so | 4,029.119 | 5.361 |
because i limited my response to one but | 4,032 | 4.16 |
even so my loop will work it's just | 4,034.48 | 3.28 |
going to iterate once and each time | 4,036.16 | 2.8 |
through that loop it's going to print | 4,037.76 | 3.039 |
the current results | 4,038.96 | 3.119 |
track name | 4,040.799 | 2.56 |
if i want to make this even more | 4,042.079 | 3.121 |
interesting let me change this limit now | 4,043.359 | 4 |
from 1 to 50 so i'll at least get back | 4,045.2 | 5.04 |
50 track names instead let me go ahead | 4,047.359 | 4.641 |
now and increase the size of my terminal | 4,050.24 | 3.92 |
once more and go ahead now and run | 4,052 | 4.72 |
python of itunes dot pi searching again | 4,054.16 | 5.76 |
for band like weezer and here we go | 4,056.72 | 6.879 |
and voila there are 50 songs that itunes | 4,059.92 | 5.6 |
has for weezer and if we scroll back up | 4,063.599 | 5.041 |
to the top here we'll see that the very | 4,065.52 | 4.96 |
first one there is indeed say it ain't | 4,068.64 | 3.919 |
so but now we got undone the sweater | 4,070.48 | 4.319 |
song buddy holly apparently another | 4,072.559 | 3.921 |
rendition of say it ain't so perhaps | 4,074.799 | 3.76 |
from another album another buddy holly | 4,076.48 | 5.359 |
undone my name is jonas and so forth | 4,078.559 | 5.52 |
questions now on this program which | 4,081.839 | 4.801 |
integrates python with a real-world | 4,084.079 | 6.321 |
third-party api | 4,086.64 | 6.32 |
yeah hi uh can we use break instead of | 4,090.4 | 5.6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.