WEBVTT
Kind: captions
Language: en

1
00:00:04.710 --> 00:00:07.540
The title of this video
won’t be exactly right.

2
00:00:07.540 --> 00:00:09.950
It only updates every few minutes at most,
and besides,

3
00:00:09.950 --> 00:00:12.860
YouTube doesn’t update its view counts in
real time anyway,

4
00:00:12.860 --> 00:00:15.320
so don’t bother refreshing
and refreshing and refreshing,

5
00:00:15.320 --> 00:00:17.940
you won’t actually be able to see it
ticking up second-by-second.

6
00:00:17.940 --> 00:00:19.660
If it’s actually 100% spot-on,

7
00:00:19.670 --> 00:00:22.170
it’s a miracle, but if it’s close,

8
00:00:22.170 --> 00:00:24.730
then the code I’ve written is still working.

9
00:00:24.730 --> 00:00:26.120
But at some point, that code will break,

10
00:00:26.120 --> 00:00:29.560
and the title of this video will slip
more and more out of touch with reality.

11
00:00:29.560 --> 00:00:32.480
This is the story of how I made
that changing title work,

12
00:00:32.480 --> 00:00:35.430
why it used to be a lot easier to
make things like that work,

13
00:00:35.430 --> 00:00:38.649
and how all this ties in
to the White Cliffs of Dover

14
00:00:38.649 --> 00:00:40.300
and the end of the universe.

15
00:00:42.480 --> 00:00:45.359
Now, I’m not going to talk about
the exact details of my code here,

16
00:00:45.359 --> 00:00:46.800
it is not the important part,

17
00:00:46.800 --> 00:00:50.310
because code is just incredibly dull on camera.

18
00:00:50.310 --> 00:00:52.870
But, big-picture, if you’re automating
a job like that,

19
00:00:52.870 --> 00:00:55.129
there are two main approaches you could take.

20
00:00:55.129 --> 00:00:58.590
First: you could write something that pretends
to be a human.

21
00:00:58.590 --> 00:01:00.300
Not in some Blade Runner replicant way,

22
00:01:00.300 --> 00:01:04.100
but you could run a system that loads up the
YouTube video page,

23
00:01:04.100 --> 00:01:07.260
reads the number of views,
and then goes to the video manager,

24
00:01:07.260 --> 00:01:09.020
changes the title, and hits save.

25
00:01:09.020 --> 00:01:11.020
That’s actually not too tricky to do:

26
00:01:11.020 --> 00:01:15.380
“screen-scrapers” have been built to do
things like that for decades.

27
00:01:15.380 --> 00:01:18.270
And that’s a fairly innocent use of a screen-scraper.

28
00:01:18.270 --> 00:01:20.280
But if you can write code to change a title,

29
00:01:20.280 --> 00:01:23.430
then you can also write code that
signs up for loads of new accounts.

30
00:01:23.430 --> 00:01:26.790
Or spams people. Or sends out messages
trying to steal personal information.

31
00:01:26.790 --> 00:01:30.259
That’s why you see those
“I’m not a robot” checkboxes.

32
00:01:30.259 --> 00:01:32.149
Which aren’t impossible to defeat,
by any means,

33
00:01:32.149 --> 00:01:35.220
but they make screen-scraping like that
much, much, much, much, more difficult.

34
00:01:35.220 --> 00:01:37.950
And, plus, it’s an approach that’ll break
quickly:

35
00:01:37.950 --> 00:01:40.649
every time one of the pages that’s being
scraped gets redesigned,

36
00:01:40.649 --> 00:01:43.680
you’ll have to rewrite your code.

37
00:01:43.680 --> 00:01:47.880
But for a long time, the people who build
web services like YouTube have recognised

38
00:01:47.880 --> 00:01:52.170
that there are legitimate reasons for letting
code interact with their systems.

39
00:01:52.170 --> 00:01:54.740
Like pulling analytics data into a spreadsheet,

40
00:01:54.740 --> 00:01:59.549
or letting captioning services add subtitles
to videos quickly and automatically.

41
00:01:59.549 --> 00:02:02.920
Or you might want to hook
multiple web services together:

42
00:02:02.920 --> 00:02:05.159
to automatically tweet when
a new video goes up,

43
00:02:05.159 --> 00:02:07.530
or ask your voice assistant
to search for a playlist.

44
00:02:07.530 --> 00:02:10.840
That can and should all be done with code.

45
00:02:10.840 --> 00:02:14.270
So behind the scenes, nearly every major
web service has an "API",

46
00:02:14.270 --> 00:02:15.970
an Application Programming Interface.

47
00:02:15.970 --> 00:02:19.080
It’s a way for bits of code to pass data
and instructions

48
00:02:19.080 --> 00:02:22.250
back and forth between services safely without
having to deal with

49
00:02:22.250 --> 00:02:25.470
all the complicated visual stuff
that humans need.

50
00:02:25.470 --> 00:02:29.910
So when I want my code to change a video title,
I don’t ask it to open up a web browser.

51
00:02:29.910 --> 00:02:32.710
Instead, it sends a single request to YouTube:

52
00:02:32.710 --> 00:02:35.010
here’s the video ID,
here’s the stuff to change,

53
00:02:35.010 --> 00:02:38.000
here’s my credentials to prove that
I’m allowed to do that.

54
00:02:38.000 --> 00:02:39.830
Bundle that all up, send it over.

55
00:02:39.830 --> 00:02:41.410
And YouTube sends back a single answer:

56
00:02:41.410 --> 00:02:44.340
hopefully it’s a response code of 200,
which means “OK”,

57
00:02:44.340 --> 00:02:47.220
with confirmation of what the video’s data
has changed to.

58
00:02:47.230 --> 00:02:51.220
But if there’s some problem with that request,
it’ll send back some other status number,

59
00:02:51.220 --> 00:02:53.940
and an error message about what went wrong.

60
00:02:53.940 --> 00:02:57.720
I can write code to handle those errors,
or for something simple like this,

61
00:02:57.720 --> 00:03:01.360
I can just have it fail and log it somewhere
so I can deal with it later.

62
00:03:01.360 --> 00:03:05.530
No typing, no clicking on things;
no pretending to be a human.

63
00:03:05.530 --> 00:03:07.450
One request out, one reply back.

64
00:03:07.450 --> 00:03:10.120
At least, that’s how it’s meant to work.

65
00:03:12.220 --> 00:03:16.060
This idea, that web services could interact
with each other through code,

66
00:03:16.060 --> 00:03:18.530
was amazing when it first became popular.

67
00:03:18.530 --> 00:03:20.930
It became "Web 2.0",

68
00:03:20.930 --> 00:03:23.860
a buzzword that is now more than
fifteen years old.

69
00:03:23.860 --> 00:03:27.950
And honestly, the Web 2.0 years were some
of the most optimistic times on the web.

70
00:03:27.950 --> 00:03:31.450
All these new startups were making sure they
could interchange data with each other,

71
00:03:31.450 --> 00:03:32.880
so maybe in the future,

72
00:03:32.880 --> 00:03:36.430
you could see your friends’ Facebook statuses
on your fridge!

73
00:03:36.430 --> 00:03:40.060
Or lights could flash to warn you if
your bus was arriving early!

74
00:03:40.060 --> 00:03:43.880
The web would be all about data, and we
could make all sorts of things of our own

75
00:03:43.880 --> 00:03:45.930
to understand it and control it
and shape it.

76
00:03:45.930 --> 00:03:51.540
It was going to be the Age of Mashups:
take data, and do interesting things with it.

77
00:03:51.540 --> 00:03:54.320
I built so many things
in the days of Web 2.0.

78
00:03:54.320 --> 00:03:58.150
So many little web toys that took data from
one place and showed it in weird ways.

79
00:03:58.150 --> 00:04:01.520
And the most ridiculous, over-the-top tool
that I loved to build with

80
00:04:01.520 --> 00:04:03.220
was called Yahoo Pipes.

81
00:04:03.220 --> 00:04:05.010
You didn’t need to write any code to make a
mashup with that.

82
00:04:05.010 --> 00:04:08.060
You could just click and drag boxes on a screen
to make a flow-chart,

83
00:04:08.060 --> 00:04:09.430
and it would all be done for you,

84
00:04:09.430 --> 00:04:12.110
Yahoo would run it all on their servers,
for free.

85
00:04:12.110 --> 00:04:14.730
I made a thing called Star Wars Weather.

86
00:04:14.730 --> 00:04:17.760
It was a really simple web page,
it’d show you the weather forecast

87
00:04:17.760 --> 00:04:20.150
by comparing it to a planet from Star Wars.

88
00:04:20.150 --> 00:04:23.669
I had a million people visit that site in
one day at its peak,

89
00:04:23.669 --> 00:04:26.180
a few people genuinely used it to get the
weather every morning,

90
00:04:26.180 --> 00:04:27.509
I got lovely emails from them,

91
00:04:27.509 --> 00:04:31.000
and all the processing was done in the background
through Yahoo Pipes,

92
00:04:31.000 --> 00:04:34.200
I didn’t have to pay for some expensive server
or pay for access to the weather data.

93
00:04:34.200 --> 00:04:35.930
There didn’t seem to be any limit, either.

94
00:04:35.930 --> 00:04:37.879
Yahoo just handled it,

95
00:04:37.879 --> 00:04:40.699
because this was Web 2.0 and that was the
right thing to do,

96
00:04:40.699 --> 00:04:44.530
and, y'know they’ll figure out how to
make money later.

97
00:04:44.530 --> 00:04:46.710
Google Maps. That was free to build on, too.

98
00:04:46.710 --> 00:04:50.500
World-class maps just to play with.
I built a terrible racing game on top of it,

99
00:04:50.500 --> 00:04:54.310
put it in my own site, loads of people
played it, I didn’t pay them a penny.

100
00:04:54.310 --> 00:04:56.439
None of those free services exist now.

101
00:04:56.439 --> 00:04:59.189
And in hindsight, it was never sustainable.

102
00:04:59.189 --> 00:05:01.449
See, when Twitter launched,

103
00:05:01.449 --> 00:05:03.770
it wasn’t pitched as just an app,
or a web site;

104
00:05:03.770 --> 00:05:06.419
Twitter was a platform, a messaging service.

105
00:05:06.419 --> 00:05:09.550
You could use their web site to
read and send tweets, sure,

106
00:05:09.550 --> 00:05:11.729
or you could write code that used the API,

107
00:05:11.729 --> 00:05:15.099
that looked at tweets, that reacted to them,
or even wrote tweets of its own.

108
00:05:15.100 --> 00:05:20.580
It was so quick, so open that anyone with a
little coding experience could make stuff easily.

109
00:05:20.580 --> 00:05:24.180
Everything you could do on the Twitter website,
or later, on the app,

110
00:05:24.180 --> 00:05:28.379
everything was available in the API for your
code to play with.

111
00:05:28.379 --> 00:05:30.099
The first sign that something was wrong,

112
00:05:30.100 --> 00:05:32.820
for me at least, was the Red Scare Bot.

113
00:05:34.270 --> 00:05:38.460
It appeared in August 2009 with the face of
Joseph McCarthy as its avatar,

114
00:05:38.479 --> 00:05:41.120
and it watched the entire Twitter timeline,

115
00:05:41.120 --> 00:05:42.599
everything posted by everyone --

116
00:05:42.600 --> 00:05:45.980
because Twitter was small enough back then
that you could do that.

117
00:05:45.980 --> 00:05:48.980
And if anyone mentioned communism or socialism,

118
00:05:48.990 --> 00:05:54.009
it would quote-tweet them with… not even
really a joke, just a comment,

119
00:05:54.009 --> 00:05:57.360
just something that said
“hey, pay attention to me”!

120
00:05:57.360 --> 00:06:00.009
Hardly anyone followed it, because,
yeah, it was really annoying.

121
00:06:00.009 --> 00:06:02.689
Over the six years before it either broke
or was shut down,

122
00:06:02.689 --> 00:06:06.180
that bot tweeted more than two million times,

123
00:06:06.180 --> 00:06:09.020
two million utterly useless things added to
Twitter’s database,

124
00:06:09.020 --> 00:06:12.680
two million times that someone was
probably slightly confused or annoyed.

125
00:06:12.680 --> 00:06:15.909
Somehow it survived, even as Twitter’s rules
changed to explicitly ban

126
00:06:15.909 --> 00:06:18.250
“look for a word and reply to it” bots,

127
00:06:18.250 --> 00:06:20.840
even as countless other irritants
got shut down.

128
00:06:20.840 --> 00:06:24.050
“Search for every use of a word on Twitter
and reply to it”

129
00:06:24.050 --> 00:06:25.870
seems a lot more sinister these days,

130
00:06:25.870 --> 00:06:28.210
in a world where social media
shapes public opinion.

131
00:06:28.210 --> 00:06:31.259
We didn’t really know
what we were playing with.

132
00:06:31.259 --> 00:06:33.780
I built some Twitter bots myself,

133
00:06:33.780 --> 00:06:36.210
although they weren’t quite as annoying
as that.

134
00:06:36.210 --> 00:06:42.080
My best one tweeted any time someone edited
Wikipedia from within the Houses of Parliament,

135
00:06:42.080 --> 00:06:46.200
although I handed that political disaster
over to someone else

136
00:06:46.200 --> 00:06:47.860
only a couple of days later
when the press started calling,

137
00:06:47.860 --> 00:06:49.700
'cos that was far too much hassle.

138
00:06:49.700 --> 00:06:51.820
And those were just the harmless ones.

139
00:06:51.830 --> 00:06:54.080
To be clear, there are still people out there

140
00:06:54.080 --> 00:06:57.849
making really good and interesting
and fun Twitter bots:

141
00:06:57.849 --> 00:07:00.400
but “bot” has a whole new meaning now.

142
00:07:00.400 --> 00:07:04.439
Because it turns out you can’t open up data
access just to the good guys.

143
00:07:04.439 --> 00:07:07.220
I remember being really impressed
with Facebook’s API:

144
00:07:07.220 --> 00:07:10.279
it was brilliant, I could pull my data and
all my friends’ data,

145
00:07:10.279 --> 00:07:13.189
and do weird, interesting things with it!

146
00:07:13.189 --> 00:07:16.020
We all know how that turned out.

147
00:07:16.020 --> 00:07:20.889
It’s amazing, in hindsight, just how
naively open everything was back then.

148
00:07:20.889 --> 00:07:24.400
APIs were meant to create this whole world
of collaboration, and they did --

149
00:07:24.400 --> 00:07:27.509
at the cost of creating a whole lot of abuse.

150
00:07:27.509 --> 00:07:30.840
So over the years, the APIs got replaced with
simpler and more locked-down versions,

151
00:07:30.840 --> 00:07:33.309
or were shut down entirely.
Or, in the case of Twitter,

152
00:07:33.309 --> 00:07:37.640
their website and app gained features like
polls and group DMs which were just…

153
00:07:37.640 --> 00:07:39.379
never added to the API.

154
00:07:39.379 --> 00:07:40.379
You want to use those features?

155
00:07:40.379 --> 00:07:42.650
You’re going to have to go to
the official app or the official site.

156
00:07:42.650 --> 00:07:47.530
Because after all, if people can access the
platform however they want, with code…

157
00:07:47.530 --> 00:07:50.060
how on earth are Twitter
going to show them adverts?

158
00:07:51.340 --> 00:07:54.439
Nowadays, if you want to build something that
connects to any major site,

159
00:07:54.439 --> 00:07:56.020
there will be an approval process,

160
00:07:56.020 --> 00:07:58.620
so they can check in on what you’re doing.

161
00:07:58.620 --> 00:08:02.090
And that connection could get
shut down at any time.

162
00:08:02.090 --> 00:08:06.949
The Google Maps games I made; the Twitter
toys; anything I ever built on Yahoo Pipes;

163
00:08:06.949 --> 00:08:10.889
they’re all broken now and they can never
come back.

164
00:08:10.889 --> 00:08:14.480
Pipes must have cost Yahoo so much money.

165
00:08:14.480 --> 00:08:16.700
Even if the service you’re building on survives,

166
00:08:16.710 --> 00:08:20.800
there’s still upkeep associated with making
anything that connects to an API.

167
00:08:20.800 --> 00:08:24.089
Sooner or later, the server you’re hosting
your code on will fail,

168
00:08:24.089 --> 00:08:26.620
or there’ll be a security patch
that you’ll have to install,

169
00:08:26.620 --> 00:08:31.009
or technology will move on enough that you’ll
need to update and rewrite the whole thing,

170
00:08:31.009 --> 00:08:32.940
and you will have to ask yourself
the question:

171
00:08:32.940 --> 00:08:35.480
is it actually worth it?

172
00:08:38.460 --> 00:08:42.560
Computer history museums are filled with the
software and hardware that I grew up with

173
00:08:42.560 --> 00:08:45.520
and that I’m nostalgic for,
because they all ran on their own,

174
00:08:45.520 --> 00:08:48.160
they didn’t need any ongoing support from
an external company.

175
00:08:48.160 --> 00:08:53.080
But if what you’re making relies on some
other company’s service, then…

176
00:08:53.080 --> 00:08:56.150
archiving becomes very, very difficult.

177
00:08:56.150 --> 00:08:59.030
So for the time being, every few minutes,
my code is going out to YouTube,

178
00:08:59.030 --> 00:09:02.940
asking how many views this video has, and
then asking to update the title.

179
00:09:02.940 --> 00:09:04.580
Maybe it’s still working as you watch this.

180
00:09:04.580 --> 00:09:08.030
But eventually, it will break.

181
00:09:08.030 --> 00:09:10.150
Eventually, so will YouTube.

182
00:09:10.150 --> 00:09:11.190
So will everything.

183
00:09:11.190 --> 00:09:16.120
Entropy, the steady decline into disorder
that’s a fundamental part of the universe…

184
00:09:16.120 --> 00:09:18.700
…entropy will get us all in the end.

185
00:09:18.700 --> 00:09:21.210
And that’s why I chose to film this here.

186
00:09:21.210 --> 00:09:23.510
The White Cliffs of Dover
are a symbol of Britain,

187
00:09:23.510 --> 00:09:27.760
they are this imposing barrier,
but they’re just chalk.

188
00:09:27.760 --> 00:09:30.420
Time and tide will wash them away,
a long time in the future.

189
00:09:30.420 --> 00:09:32.270
This, too, shall pass.

190
00:09:32.270 --> 00:09:35.770
But that doesn’t mean you shouldn’t build
things anyway.

191
00:09:35.770 --> 00:09:38.310
Just because something is going
to break in the end,

192
00:09:38.310 --> 00:09:41.980
doesn’t mean that it can’t have an effect
that lasts into the future.

193
00:09:41.980 --> 00:09:43.800
Joy. Wonder. Laughter. Hope.

194
00:09:43.800 --> 00:09:46.980
The world can be better because of what you
built in the past.

195
00:09:46.980 --> 00:09:49.360
And while I do think that the long-term goal
of humanity should be

196
00:09:49.360 --> 00:09:51.720
to find a way to defeat entropy,

197
00:09:51.720 --> 00:09:55.330
I’m pretty sure no-one knows where to start
on that problem just yet.

198
00:09:55.330 --> 00:10:00.430
So until then: try and make sure the things
you’re working on push us in the right direction.

199
00:10:00.430 --> 00:10:01.770
They don’t have to be big projects,

200
00:10:01.770 --> 00:10:04.540
they might just have an audience of one.

201
00:10:04.540 --> 00:10:06.530
And even if they don’t last:

202
00:10:06.530 --> 00:10:09.760
try to make sure they leave
something positive behind.

203
00:10:09.760 --> 00:10:14.180
And yes, at some point, the code that’s
updating the title of this video will break.

204
00:10:14.180 --> 00:10:16.400
Maybe I’ll fix it.
Maybe I won’t.

205
00:10:16.410 --> 00:10:18.940
But that code was never the important part.

