text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
unrelatedly for whatever reason enter
6,783.8
5.52
that is not their Twitter username so we
6,787.28
4.359
need to have some conditional logic I
6,789.32
4.44
would argue so that for this program's
6,791.639
5
sake we're only printing out or in a
6,793.76
4.76
backend system we're only saving into
6,796.639
4.56
our database or a CSV file the username
6,798.52
4.96
if we actually match matched the proper
6,801.199
5.681
pattern so rather than use re.sub which
6,803.48
6.08
is useful for cleaning up data as we've
6,806.88
4.4
done here to get rid of something we
6,809.56
4.24
don't want there why don't we go back to
6,811.28
6.56
re. search where we began today and use
6,813.8
6.12
it to solve the same problem but in a
6,817.84
4.04
way that's conditional whereby I can
6,819.92
3.84
confidently say yes or no at the end of
6,821.88
4.4
my program here's the username or here
6,823.76
4.56
it is not so let me go ahead now and
6,826.28
4.16
I'll clear my terminal window here I'm
6,828.32
4.399
going to keep most of uh the I'm going
6,830.44
4.12
to keep the first two lines the same
6,832.719
4.081
where I import re and I get the URL from
6,834.56
4.519
the user but this time let's do this
6,836.8
5.12
let's this time search for using re.
6,839.079
5.401
search instead of re.sub the following
6,841.92
3.799
I'm going to start matching at the
6,844.48
3.88
beginning of the UR of the string
6,845.719
5.121
https uh question mark to make the S
6,848.36
5.12
optional colon SL slash then I'm going
6,850.84
4.96
to make my uh
6,853.48
5.08
www uh optional by putting that in
6,855.8
5.399
question marks there then a twitter.com
6,858.56
4.599
with a literal do there so I'll stay
6,861.199
5.4
ahead of that issue too then a slash and
6,863.159
5.841
then well this is where David J ma is
6,866.599
5.201
supposed to go how do I detect this well
6,869
4.36
I think I'll just tolerate anything at
6,871.8
4.6
the end of the URL here all right dollar
6,873.36
5.68
sign at the very end close quote for the
6,876.4
4.08
moment I'm going to stipulate that we're
6,879.04
3.159
not going to worry about question marks
6,880.48
4
at the end or hashes like for fragment
6,882.199
4.241
IDs and URLs we're going to assume for
6,884.48
4.4
Simplicity now that the URL just ends
6,886.44
5.08
with the username alone now what am I
6,888.88
4.319
going to do well I want search for this
6,891.52
3.52
URL specifically and I'm going to ignore
6,893.199
5.52
case so re. ignore case uh applying that
6,895.04
6.52
same lesson learned from before re.
6,898.719
5.641
search recall will return to you the
6,901.56
4.519
matches you've captured well what do I
6,904.36
3.719
want to capture well I want to capture
6,906.079
4.481
everything to the right of the
6,908.079
5.56
twitter.com URL here so let me surround
6,910.56
6.039
what should be the user's username with
6,913.639
5.44
parentheses not for making them optional
6,916.599
4.201
but to say capture this set of
6,919.079
4.801
characters now are search recall returns
6,920.8
5.399
and answer matches will be my variable
6,923.88
3.799
name again but I could call it anything
6,926.199
5.52
I want and then I can do this if matches
6,927.679
6.44
now I know I can do this let's print out
6,931.719
5.36
the format string username colon and
6,934.119
6.241
then uh what do I want to print out well
6,937.079
5.361
I think I want to print out matches.
6,940.36
5.56
group one for my matched username all
6,942.44
5.6
right so what am I doing just to recap
6,945.92
4.239
line one I'm importing the library line
6,948.04
4.32
two I'm getting the URL from the user so
6,950.159
4.881
nothing new there line five I'm
6,952.36
5.92
searching the user's URL as indicated
6,955.04
5.76
here as the second argument for this
6,958.28
5.399
regular expression this pattern I have
6,960.8
7.12
surrounded the dot plus with parentheses
6,963.679
6.601
so that they are captured ultimately so
6,967.92
5.12
I can extract in this final scenario the
6,970.28
5.879
user's username if I indeed got a match
6,973.04
6.4
and matches is non none it is actually
6,976.159
5.801
containing some match then and only then
6,979.44
5.159
print out username in this way let me
6,981.96
5.279
try this now if I run python of twitter.
6,984.599
5.841
and type in HTTPS
6,987.239
6.081
www.google.com now nothing gets printed
6,990.44
4.84
so I've at least solved the mistake we
6,993.32
3.839
just saw where I was just assuming that
6,995.28
4.399
my code worked now I'm making sure that
6,997.159
4.801
I have searched for and found the
6,999.679
5.121
Twitter URL prefix all right well let's
7,001.96
6.639
run this for real now python of twitter.
7,004.8
7.76
https twitter.com davidj maen but note I
7,008.599
7.401
could use HTTP I could use www I'm just
7,012.56
5.639
going to go ahead here and hit
7,016
4.92
enter huh
7,018.199
6.321
none what has gone
7,020.92
6.279
wrong this one's a bit more
7,024.52
6.92
subtle but why does matches. group one
7,027.199
6.761
contain nothing wait a minute let me
7,031.44
4.759
maybe I maybe I did this wrong maybe
7,033.96
4.239
maybe do we need the www let me run it
7,036.199
4.96
again so here we go https let's add it
7,038.199
9.361