YouTube2Text

Разбор лайвкода в Т-Банк на 450к / Android собеседование — Transcript

by Фабрика Офферов / Артур Илькаев · 3,498 words · 527 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Hello everyone. I'm Artur, a mobile
  2. 0:02developer. In this video, I will break
  3. 0:04down a solution to a real interview
  4. 0:06task for an Android developer position
  5. 0:08at T-Bank. This autumn, an HR
  6. 0:10representative from the bank reached
  7. 0:11out to me. They were offering a salary
  8. 0:13range around 400,000 rubles. And I
  9. 0:15decided to go through the interview
  10. 0:16process. After the initial chat with HR
  11. 0:19and discussing my experience, they
  12. 0:20decided to fast-track me through a
  13. 0:22simplified process with just one
  14. 0:24technical interview. Other developers
  15. 0:26usually go through more technical
  16. 0:28stages. I want to show not just the
  17. 0:30solution, but also explain my approach
  18. 0:33to such tasks and break down the topics
  19. 0:35they cover. Live coding is becoming
  20. 0:39more common in interviews because
  21. 0:41companies want to see if you can
  22. 0:43navigate code fluently, test your
  23. 0:45knowledge of specific topics, and see
  24. 0:47if you can clarify requirements,
  25. 0:49explain your thought process, and
  26. 0:51directly solve the tasks given to you.
  27. 0:55In this video, I am analyzing only one
  28. 0:56of these real-world tasks. But my
  29. 0:58students have exclusive access to
  30. 1:00breakdowns of over fifty tasks from
  31. 1:03companies like Yandex, Avito, Ozon,
  32. 1:05Alfa, Wildberries, and other major big
  33. 1:07tech firms. Let's move on to the task I
  34. 1:10was given. What do we see here? There
  35. 1:13is a lot of poorly written code here.
  36. 1:16To start with, I'd like to understand
  37. 1:18the main idea, what's even happening
  38. 1:21here. Let's try to take a look at it.
  39. 1:24Well, from top to bottom, there is some
  40. 1:28"const" object with a constant index.
  41. 1:32There is a tag, there is a "UserData"
  42. 1:35class with an ID, name, and phone
  43. 1:38number. This all looks like fluff that
  44. 1:41will need to be fixed. Apparently, the
  45. 1:44central class here is...And judging by
  46. 1:46the lines of code, the largest one is "
  47. 1:49UsersHolderSingleton". Let's take a
  48. 1:51look at what's happening here. We have
  49. 1:54a companion object with an instance of
  50. 1:57this class. There is a "getInstance"
  51. 2:02method that returns this class directly
  52. 2:05. There are some fields, a "
  53. 2:08usersExecutor", and an "update" method
  54. 2:11that takes a user ID, their phone
  55. 2:14number, and formats it. There's some
  56. 2:18fluff here, and then it searches for
  57. 2:20this ID in the array. If found, it
  58. 2:23replaces the value with the new phone
  59. 2:26number. Okay. So, the main idea of this
  60. 2:30class is that it has an "update" method
  61. 2:33to change a phone number. And it holds
  62. 2:36users. So it's a singleton because it
  63. 2:40implements the singleton pattern, and a
  64. 2:43holder because it stores a list of
  65. 2:46users. And actually, the main thing
  66. 2:50it's responsible for is changing the
  67. 2:52phone number. So I would also call it
  68. 2:55an "updater" or "PhoneUpdater". Let's
  69. 2:59do that. "
  70. 3:01UsersPhoneUpdaterHolderSingleton".
  71. 3:04Robert Martin is crying somewhere. Well
  72. 3:06, it seems that we will have to fix
  73. 3:08everything here, as if we could just do
  74. 3:10it right from top to bottom. So, let's
  75. 3:12look at "const". Where is this used?
  76. 3:15Ctrl + F "const" is our best friend
  77. 3:17here. Aha. When iterating through the
  78. 3:21user list, we go through the indices.
  79. 3:24Well, we know that in Java and Kotlin,
  80. 3:27indexing is zero-based, so we should
  81. 3:30set the index to zero. And it seems
  82. 3:33unnecessary to move this to a separate
  83. 3:36constant. We can just write it like
  84. 3:38this and remove that. Next, since we're
  85. 3:42looking at this for-loop, we have an
  86. 3:44index out of bounds here because
  87. 3:47indexing is from zero to size -1. So we
  88. 3:50can write it this way instead. Or
  89. 3:54there's an until function that does the
  90. 3:57work for us and iterates from zero to
  91. 4:01size -1. Or we could make it even
  92. 4:05simpler and just write for (i in
  93. 4:07users.indices). Pardon my English. Next
  94. 4:13, we have a tag; where is it used? In
  95. 4:18the logger. And then it's unclear why
  96. 4:23this tag is at the top-level. It seems
  97. 4:27it could be moved into a Companion
  98. 4:30Object, directly inside the class, and
  99. 4:33replaced with...a compiler constant,
  100. 4:39const. And why is that necessary? Const
  101. 4:42is a compile-time constant, meaning the
  102. 4:45value is calculated at compile-time and
  103. 4:48substituted at the call site, which
  104. 4:51speeds up code execution at runtime.
  105. 4:55Okay, let's move on. We have a UserData
  106. 4:59class. Uh, we immediately see mutable
  107. 5:03properties in this class. Well, anyone
  108. 5:06who has worked with Kotlin at all knows
  109. 5:08that using data classes is a best
  110. 5:10practice. Well, why? At the very least,
  111. 5:13we get equals and hashcode for use in
  112. 5:15collections that rely on calculating
  113. 5:17hash functions from keys and comparing
  114. 5:19objects. Additionally, we get a copy
  115. 5:23method to create a new instance with
  116. 5:26modified class fields. And this copy
  117. 5:30lambda, which takes the old user ID and
  118. 5:33phone number to change and then creates
  119. 5:37a new instance, hints at that. And if
  120. 5:41we make all fields immutable, the class
  121. 5:43becomes immutable. And that means we no
  122. 5:46longer fear race conditions when
  123. 5:48changing class data. But actually, a
  124. 5:50data class is not a panacea for
  125. 5:52concurrency problems. If a class
  126. 5:55instance is stored somewhere and the
  127. 5:57instance changes, we still need to
  128. 5:58synchronize access to it. Let's change
  129. 6:02it to a data class. Uh-huh. Moving on
  130. 6:12to our main class. It is open, meaning
  131. 6:16it's open for inheritance, but inside
  132. 6:19this class, all methods and fields are
  133. 6:22final, so we won't be able to override
  134. 6:26anything by inheriting from it.
  135. 6:29Therefore, it's more appropriate not to
  136. 6:32make it open for inheritance and keep
  137. 6:34it final. Let's look further. We have a
  138. 6:37private constructor. Well, that's so we
  139. 6:39create an instance of the class in the
  140. 6:41getInstance method. Everything is okay
  141. 6:44here. Let's see what is passed to the
  142. 6:47constructor. Context and a repository
  143. 6:50are being passed. We can talk about
  144. 6:53passing the context separately, but at
  145. 6:56the very least, these fields should be
  146. 6:59private to restrict access, maintain
  147. 7:01the encapsulation of our key class, and
  148. 7:04avoid exposing unnecessary fields.
  149. 7:07Let's move on. It inherits from
  150. 7:11LoggerProvider, uh, apparently to get
  151. 7:16this value for the logger. Is it
  152. 7:20appropriate for PhoneUpdateSingleton to
  153. 7:23inherit from LoggerProvider? I don't
  154. 7:26think so. This is a classic question
  155. 7:29about the difference between
  156. 7:31composition and inheritance. In general
  157. 7:33, preference should be given to
  158. 7:35composition over inheritance.
  159. 7:37Inheritance should be used when classes
  160. 7:39have a clear "is-a" relationship. When
  161. 7:41inheriting, we take everything from the
  162. 7:44superclass. This can lead to having
  163. 7:46functionality that we don't need, which
  164. 7:48is a violation of the Interface
  165. 7:49Segregation Principle. With composition
  166. 7:53, however, we only depend on the
  167. 7:54functionality we explicitly call.
  168. 7:57Inheritance also breaks encapsulation.
  169. 8:00A good example is provided in Effective
  170. 8:03Java and Effective Kotlin, where a
  171. 8:05subclass of HashSet was created to
  172. 8:07simply count all elements added over
  173. 8:10time. We overrode the add and addAll
  174. 8:13methods there. In the add method, we
  175. 8:15added one, and in the addAll method, we
  176. 8:17added the size of the collection being
  177. 8:19added. It would seem logical, but if
  178. 8:22you call addAll on this HashSet
  179. 8:24subclass, the result will be twice as
  180. 8:27large as expected because, under the
  181. 8:29hood, the HashSet's addAll method calls
  182. 8:31the add method. This problem could have
  183. 8:35been avoided if our new set contained a
  184. 8:37HashSet instead of being its subclass.
  185. 8:40Also, composition is more flexible
  186. 8:42because you can inherit from only one
  187. 8:44class, but you can contain as many as
  188. 8:46you want. And with inheritance, we take
  189. 8:49everything from the superclass, which
  190. 8:50changes the behavior of all child
  191. 8:52classes. With composition, while we can
  192. 8:55certainly affect the behavior being
  193. 8:57used, we know exactly which behavior
  194. 8:58from the dependent class is being
  195. 9:00utilized. And, of course, we have tests
  196. 9:03written for that. If necessary, we can
  197. 9:05even mock the class being used.
  198. 9:08Therefore, I would much rather not
  199. 9:11inherit from LoggerProvider here, but
  200. 9:14instead pass it into the constructor
  201. 9:21and get the logger from the
  202. 9:24LoggerProvider. Let's figure out what's
  203. 9:28going on here with the getInstance
  204. 9:29method and getting an instance of this
  205. 9:32class. First of all, our getInstance
  206. 9:35method is not in a companion object,
  207. 9:38but in the class itself. And so, to
  208. 9:40call it, we would have to create an
  209. 9:42instance of this class somehow, and
  210. 9:44only then could we call the getInstance
  211. 9:46method. This isn't a static method, so
  212. 9:49it needs to be moved into the companion
  213. 9:52object. Okay, let's format the code
  214. 9:57right away. And furthermore, our
  215. 10:01instance is volatile. What is happening
  216. 10:04here? So, in it, we check that if the
  217. 10:08instance is empty, or rather nullable,
  218. 10:10we create it and only then return it.
  219. 10:14Actually, a race condition can occur
  220. 10:17here. If two threads enter this method
  221. 10:21simultaneously and the first one reads
  222. 10:23the instance value, it will be nullable
  223. 10:26. The second one will also enter this
  224. 10:28method, read the instance value, and it
  225. 10:30will be nullable. Both will perform the
  226. 10:33check and both will create an instance
  227. 10:36of this class, resulting in invalid
  228. 10:39data. But we want to create the
  229. 10:43instance strictly once. By the way, we
  230. 10:46need to change the class name here. And
  231. 10:49there is another point here: a "val" is
  232. 10:52passed to the method parameter. There
  233. 10:55is no sense in this at all. This code
  234. 10:57won't compile simply because we pass
  235. 11:01references to class instances into
  236. 11:04method parameters. And "val" is only
  237. 11:07used in the primary constructor to make
  238. 11:10the passed parameter a class property.
  239. 11:14There is no point in doing that here,
  240. 11:15yes. Regarding the race condition issue
  241. 11:18. How can we ensure that multiple
  242. 11:21instances of this class aren't created
  243. 11:24when using this method in a
  244. 11:26multithreaded environment? Well, the
  245. 11:29first thing that comes to mind is that
  246. 11:31we can simply mark this method as
  247. 11:33synchronized. What will happen in that
  248. 11:35case? Performance will suffer here
  249. 11:38because we want to create the instance
  250. 11:40only once, and for all other times,
  251. 11:42just read the value. In my opinion, to
  252. 11:47make this code more efficient, we
  253. 11:49should use a multithreading pattern
  254. 11:51called Double-Checked Locking. What is
  255. 11:54it for? It is for limiting access to a
  256. 11:57critical section, where access must be
  257. 11:59for writing based on some condition.
  258. 12:03And we want to perform this operation
  259. 12:04strictly once when this condition is
  260. 12:06met. And all other times, when this
  261. 12:10operation or check is not met, we don't
  262. 12:13want to perform any synchronization.
  263. 12:15What do we need to do here? We need to
  264. 12:17remove "synchronized" because it
  265. 12:19suffers, because it affects performance
  266. 12:21. What do we need to do after checking
  267. 12:23that the instance is equal? Watch
  268. 12:26closely. I am setting up a synchronized
  269. 12:29block. Here, I perform this check again
  270. 12:34. And only after that do I populate the
  271. 12:41instance. This is, in fact, the
  272. 12:43implementation of the Double-Checked
  273. 12:45Locking pattern. What is happening here
  274. 12:47? We perform the check for the first
  275. 12:49time without "synchronized". If this
  276. 12:52check passes successfully, we then
  277. 12:55start the critical block. And in this
  278. 12:58critical block, we check our condition
  279. 13:01once more and perform the required
  280. 13:03operation. It looks a bit strange, but
  281. 13:07it is the Double-Checked Locking
  282. 13:09pattern, specifically so that we write
  283. 13:12only once and read without the
  284. 13:14synchronized block all other times. In
  285. 13:18fact, this pattern can be used not only
  286. 13:21for a GoF singleton. It is needed in
  287. 13:25general to limit access to a critical
  288. 13:27section based on some condition to
  289. 13:29prevent race conditions. This can be
  290. 13:32useful. For example, you have some kind
  291. 13:36of interceptor for your OkHttp. You
  292. 13:40want to refresh your access tokens
  293. 13:42there if they expire. And if you put "
  294. 13:45synchronized" on the entire intercept
  295. 13:47method, you won't have parallel
  296. 13:48requests. Each of your requests will go
  297. 13:51sequentially, which affects performance
  298. 13:53. And inside this interceptor, you can
  299. 13:56check that if you get a response saying
  300. 13:59your token has expired, only then do
  301. 14:01you enter the synchronized block,
  302. 14:04perform the check again, so that only
  303. 14:06one of the requests refreshes the token
  304. 14:09. And after that, you update the token,
  305. 14:12and this check of yours will not be
  306. 14:14passed, and you will execute the rest
  307. 14:16of your code, your remaining request.
  308. 14:18Okay, it seems we have sorted out
  309. 14:21double-checked locking. Let's move on.
  310. 14:24We have "users" and "executor" fields.
  311. 14:26Let's see if "executor" is used
  312. 14:28anywhere. Executor is not used anywhere
  313. 14:32at all, so it can be removed. What's
  314. 14:34next? Users. Here we get the value from
  315. 14:37the repository. And there is an
  316. 14:39important point here that, in fact, it
  317. 14:42works like this. And every time we
  318. 14:44access "users", we will get the current
  319. 14:47value from the repository. And this
  320. 14:50variable is mutable. First of all, this
  321. 14:53code won't compile because we can only
  322. 14:57create such a getter for an immutable
  323. 15:00variable. How appropriate is this at
  324. 15:03all? This field of ours is used to
  325. 15:07search for the ID we need. We get the
  326. 15:11value and then change this value in the
  327. 15:14list. But at the same time, this value
  328. 15:18changes locally and is not propagated
  329. 15:22to the repository to be written to disk
  330. 15:25or sent to the network. And it seems
  331. 15:30there is a mistake here in that if we
  332. 15:33change our users locally, then upon
  333. 15:36restarting the application, this data
  334. 15:39will be lost. I propose adding a method
  335. 15:44to the repository, an update method,
  336. 15:46which will update the phone number by
  337. 15:49ID, so that the data is current when
  338. 15:52the app restarts. Let's add the ID here
  339. 15:56and add the new phone number here. What
  340. 16:01do I propose doing here? We will
  341. 16:04receive the current list of users in
  342. 16:06the Update method. Aha. So, here I get
  343. 16:17the list of users. And when I find the
  344. 16:21right user, it turns out that "found
  345. 16:24user" is "users at i". And then we need
  346. 16:30to pass the updated user to the
  347. 16:33repository. I will also have an update
  348. 16:36method here. It will be "foundUser.id".
  349. 16:42The new phone number is "formattedPhone
  350. 16:45". That's it. We then remove this here.
  351. 16:49We are not modifying it locally. And
  352. 16:51this copy lambda is no longer needed.
  353. 16:55What other problems are there here? To
  354. 16:58format the phone, we access resources,
  355. 17:01apparently where some pattern is
  356. 17:03defined, and pass the parameter,
  357. 17:05actually, this phone number. In general
  358. 17:09, using context here can create
  359. 17:11problems for us. Why? It's important to
  360. 17:15ensure, at the very least, that this
  361. 17:16context is an application context. If
  362. 17:20it’s an activity context, then when
  363. 17:22the activity configuration changes or
  364. 17:24it's destroyed, we’ll have a memory
  365. 17:26leak because this class holds a
  366. 17:28reference to the activity. How can this
  367. 17:32be solved? Well, the simplest option is
  368. 17:34that when creating this instance, we
  369. 17:36can do it like this: application
  370. 17:38context. And we will solve the memory
  371. 17:41leak problem. But even if we solved the
  372. 17:44memory leak, the context tightly binds
  373. 17:46us to Android and prevents us from
  374. 17:48going Kotlin Multiplatform. Or we will
  375. 17:52have a problem where we need to mock
  376. 17:54the context during testing. Anyone who
  377. 17:57has mocked a context plus chat knows
  378. 17:58what kind of problem that is. Therefore
  379. 18:00, I would create a separate interface
  380. 18:03for phone number formatting. That is,
  381. 18:06we would have a PhoneFormatter
  382. 18:10interface with a format method that
  383. 18:14takes a phone number and returns a
  384. 18:18formatted phone number. And instead of
  385. 18:23context, let's use PhoneFormatter.
  386. 18:30Accordingly, we need to pass this
  387. 18:32PhoneFormatter to getInstance. And pass
  388. 18:36it when creating the class instance.
  389. 18:38And what will we do here? Format is
  390. 18:47format. What advantage will this give
  391. 18:52us? We will get more flexibility. We
  392. 18:55will be able to override the
  393. 18:56PhoneFormatter and fake this interface
  394. 18:59during testing. We are not tied to the
  395. 19:01context. And if we go to Kotlin
  396. 19:05Multiplatform, we can use expect/actual
  397. 19:08to do it for Android, iOS, and other
  398. 19:11targets. Therefore, I suggest leaving
  399. 19:14it this way. Let's move on. What else
  400. 19:16is confusing here? Let's see if there
  401. 19:18are any other problems in the code and
  402. 19:21if it can be improved or simplified. So
  403. 19:24, what is happening here? We iterate
  404. 19:27through the list of users, looking to
  405. 19:30see if there is a user with the ID we
  406. 19:32need, to change the phone number and
  407. 19:34pass these changed data to the
  408. 19:36repository. It feels like we want to
  409. 19:40simplify it a bit and do something like
  410. 19:44this. You can find the user simply via
  411. 19:49a lambda where the ID equals the ID.
  412. 19:58And if we didn't find the user, we can
  413. 20:01exit this function. In that case, we
  414. 20:04can format the phone number later so as
  415. 20:07not to perform unnecessary operations.
  416. 20:10Okay. Let's say we found the user,
  417. 20:13formatted the phone number, and then we
  418. 20:15call our update method. We call logging
  419. 20:19. Aha, here we change it to formatter.
  420. 20:24Okay. The code has become a little
  421. 20:27simpler. What other problems are there
  422. 20:29here? Our user repository returns a
  423. 20:32Linked List. What is the problem here?
  424. 20:36That is, the repository provides a
  425. 20:38concrete implementation of the list
  426. 20:39class externally. And for me, as a user
  427. 20:43of this repository, it shouldn't matter
  428. 20:45. It's just important for me to get
  429. 20:48that list. If we suddenly want to
  430. 20:51change the underlying Linked List to an
  431. 20:53ArrayList or CopyOnWriteArrayList, then
  432. 20:55usage sites will fail to compile if we
  433. 20:57explicitly specify the type during the
  434. 20:59call. If we start depending on specific
  435. 21:04linked list methods, like push or pop,
  436. 21:07and remember that the linked list also
  437. 21:10implements the Deque interface, clients
  438. 21:13will have to stop using those methods.
  439. 21:17All in all, it’s inflexible and also
  440. 21:19breaks encapsulation. Let's just change
  441. 21:22it to a List. Here, when we call it, it
  442. 21:25doesn’t matter which specific list it
  443. 21:27is. And for efficient searching, we
  444. 21:31don't want to iterate through this list
  445. 21:34every time, because that has linear
  446. 21:37complexity, but rather we want to check
  447. 21:40if a user is in our repository in
  448. 21:43constant time. And for this, a Map
  449. 21:46would be better suited than a List.
  450. 21:50Especially if we want to make the
  451. 21:52repository flexible; if it has some
  452. 21:54memory cache inside, a map is perfect
  453. 21:57here if we frequently update a user by
  454. 21:59a specific ID. Therefore, I suggest
  455. 22:03changing it to a Map, where the key
  456. 22:07will be our ID and the value will be
  457. 22:10User Data. So, what do we get from this
  458. 22:13? We get a map with a list of users.
  459. 22:19Integer, User Data. And how do we find
  460. 22:23a user? We can use users.get (ID). And
  461. 22:29if we don't find them, we abort the
  462. 22:31execution of this method. Then we
  463. 22:35format, and the repository itself will
  464. 22:37decide how to update the internal
  465. 22:40HashMap. That is, update the in-memory
  466. 22:43cache, or go out to disk or the network
  467. 22:45. And then, naturally, we log the
  468. 22:49result. Look at what other problems are
  469. 22:52here. After improving the update method
  470. 22:56, it seems like we don't need to make
  471. 22:59this class a singleton anymore, because
  472. 23:02nothing is being stored inside this
  473. 23:04class. There is simply no point in a
  474. 23:08singleton. We would just be keeping an
  475. 23:10instance of this class in memory
  476. 23:12constantly. Moreover, it doesn't even
  477. 23:15contain any data that needs to be kept
  478. 23:17up to date. So I suggest getting rid of
  479. 23:22the singleton. It makes no sense. Aha,
  480. 23:27we need to keep the tag. Accordingly,
  481. 23:30it's no longer a singleton. And it's
  482. 23:33not a holder because it doesn't store a
  483. 23:35list of users. So now it's just an
  484. 23:38updater by ID. It feels like this is
  485. 23:41already starting to resemble something.
  486. 23:44Yes, we also need to remove the private
  487. 23:46constructor so we can create it. It
  488. 23:49feels like this is now a simple class
  489. 23:51that we can use in our presentation
  490. 23:53layer to update a phone number. Let's
  491. 23:56just rename this. User Phone Updater.
  492. 23:59Use Case. Looks like that's everything.
  493. 24:02Actually, this code can be improved
  494. 24:05even further. In particular, in the use
  495. 24:08case—that is, in the business logic,
  496. 24:11in the domain layer—we are performing
  497. 24:14the user search ourselves and checking
  498. 24:17if that user exists in the repository.
  499. 24:20And it feels like that is not the
  500. 24:22responsibility of the business logic.
  501. 24:26In the use case, we just want to send a
  502. 24:28request to the repository, and the
  503. 24:30repository itself will decide whether
  504. 24:32it needs to update, search for a user,
  505. 24:35or create a new one. So I would suggest
  506. 24:39removing this from here, and we would
  507. 24:41just format the phone number when
  508. 24:44calling the update method, then send it
  509. 24:46to the repository. The repository will
  510. 24:49decide for itself what it needs to do.
  511. 24:51We also have a logger here. I don't
  512. 24:56think it's the use case's
  513. 24:57responsibility to handle any logging.
  514. 25:01This should be done either on the data
  515. 25:04layer side inside the repository, or on
  516. 25:06the presentation layer, for example, in
  517. 25:09the ViewModel. Well, it all depends on
  518. 25:12your business logic, so I also suggest
  519. 25:16removing the logging. Removing it.
  520. 25:19Removing it. Accordingly, the object
  521. 25:21companies, and we remove it from the
  522. 25:23constructor. I would also like to
  523. 25:25rename the repositories. Uh-huh. And
  524. 25:32the code has already become a bit
  525. 25:35cleaner. We've removed, well, about 80
  526. 25:38percent of the code. I suggest we wrap
  527. 25:42up here.

About this transcript

This page contains the full transcript of Разбор лайвкода в Т-Банк на 450к / Android собеседование by Фабрика Офферов / Артур Илькаев, generated from the public captions YouTube serves with the video. The transcript has 3,498 words across 527 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.