Nightwing11 commited on
Commit
a9725a0
·
1 Parent(s): 9e9f1ea

Path issue resolved

Browse files
Data/Data/transcripts/3-ukCGQJk2c_20250121201324.txt DELETED
The diff for this file is too large to render. See raw diff
 
Data/Data/transcripts/qUz93CyNIz0_20250116201425.txt DELETED
@@ -1,843 +0,0 @@
1
- welcome to hubman Labb Essentials where
2
- we revisit past episodes for the most
3
- potent and actionable science-based
4
- tools for mental health physical health
5
- and
6
- performance I'm Andrew huberman and I'm
7
- a professor of neurobiology and
8
- Opthalmology at Stanford School of
9
- Medicine today's episode is going to be
10
- all about the science of emotions and
11
- today we're going to talk in particular
12
- about something that most often is
13
- called stress now you might be thinking
14
- wait stress isn't an emotion but stress
15
- really lies at the heart of whether or
16
- not our internal
17
- experience is matched well or not to our
18
- external experience or the events that
19
- are happening to us and around us and as
20
- you'll soon see those converge or
21
- combine to create what we call emotions
22
- I'd like you to come away from today's
23
- episode with what I call an
24
- organizational logic a framework for
25
- think about these things that typically
26
- we just call happy or sad or depressed
27
- or anxious and I'm going to make sure
28
- that you have tools that are grounded in
29
- physiology and Neuroscience that will
30
- allow you to navigate this otherwise
31
- complex space that we call emotions that
32
- will allow you to ground yourself better
33
- when you're feeling like life is
34
- Weighing on you or you're kind of being
35
- pulled by the currents of life as well
36
- as to support other people whether or
37
- not that's in a psychological practice
38
- if you're if you're a practitioner or
39
- you have clients or children or spouses
40
- really to be able to support other
41
- people in your environment better and as
42
- you may recall the nervous system which
43
- includes the brain and the eyes and the
44
- spinal cord but also all the connections
45
- with the organs of the body includes the
46
- brain and body and those organs of the
47
- body your gut and your liver and your
48
- spleen they are also communicating with
49
- the brain so I look forward to a day in
50
- fact when we no longer think about
51
- Neuroscience as just the brain and many
52
- neuroscientists now also think about the
53
- body of course the brain controls the
54
- body but the body is also having a very
55
- profound and concrete influence on the
56
- brain today we're going to talk about
57
- objective tools that match the brain
58
- body experience or separate the brain
59
- body experience in ways that leverage
60
- your ability to lean into life better to
61
- feel better literally to just feel
62
- better about what you're experiencing
63
- and believe it or not to be able to
64
- control your emotions when that's
65
- appropriate okay so what is stress we
66
- hear all the time that stress is bad we
67
- hear people saying they're really
68
- stressed out what is
69
- stress stress at its core is a
70
- generalized system it wasn't designed
71
- for tiger tigers attacking us or people
72
- attacking us it's a system to mobilize
73
- other systems in the brain and body it
74
- wasn't designed for one thing
75
- thing and that gives it a certain
76
- advantage in taking over our the state
77
- of our brain and body but it also gives
78
- you all of us an advantage in
79
- controlling it because it's based on
80
- hardwired biological mechanisms and
81
- there are hardwired biological
82
- mechanisms meaning cells and chemicals
83
- and Pathways and tissues that exist in
84
- you right now that require no
85
- neuroplasticity that allow you to put a
86
- break on stress and so we're going to
87
- talk about those so let's talk about the
88
- stress response and by doing that you
89
- will understand exactly why the tools
90
- I'm going to give you work for those of
91
- you that are saying wait I just want the
92
- tools just give me a summary trust me if
93
- you understand mechanism you are going
94
- to be in a far better position to
95
- incorporate these tools to teach these
96
- tools to others and to modify them as
97
- your life circumstances change let's be
98
- clear about what we already know which
99
- is that
100
- stressors can be
101
- psychological or they can be physical
102
- okay if I put you outside on a cold day
103
- without a jacket for a very long time
104
- that is stressful if I have you prepare
105
- for too many exams at once and you can't
106
- balance it all with your sleep schedule
107
- and your other needs for comfort and
108
- well-being like food rest sleep and
109
- social connection that is stressful so
110
- what happens when the stress response
111
- hits let's talk about the immediate or
112
- what we call the acute stress response
113
- response we could also think of this as
114
- short-term stress so you have a
115
- collection of neurons that start right
116
- about at your neck and run down to about
117
- your navl a little bit lower and those
118
- are called the sympathetic chain ganglia
119
- when something stresses us out either in
120
- our mind or because something enters our
121
- environment that chain of neurons
122
- becomes activated like a bunch of
123
- dominoes falling all at once it's very
124
- fast when those neurons are activated
125
- cocoline is released but there are some
126
- other neurons for the afficionados out
127
- there they're called the postganglionic
128
- neurons those ones respond to that
129
- acetylcholine and then they release
130
- epinephrine which is the equivalent to
131
- Adrenaline so we have this system where
132
- very fast whenever we're stressed the
133
- core of our body these neurons down the
134
- middle of our body release these
135
- chemicals and then there's adrenaline or
136
- epinephrine released at particular
137
- organs and acts in particular ways some
138
- things like the muscles of your legs and
139
- your heart and other things that need to
140
- be active when you're stressed they have
141
- a certain kind of receptor which is
142
- called the beta receptor and that beta
143
- receptor responds to epinephrine and
144
- blood vessels dilate they get bigger and
145
- blood rushes into to our legs the heart
146
- rate speeds up lots of things happen
147
- that get activated and at the same time
148
- that epinephrine activates other
149
- receptors on certain tissues that we
150
- don't need the ones involved in
151
- digestion reproduction and things of
152
- that sort that are
153
- luxuries for when things are going well
154
- not things to pay attention to when
155
- we're stressed so the stress response is
156
- too pronged it's a yes for certain
157
- things and it's a know you may not right
158
- now for other things that's why you feel
159
- blood in certain organs and tissues of
160
- your body but not in others but
161
- basically you are activated in ways that
162
- support you moving and that's because
163
- fundamentally the stress response is
164
- just this generic thing that says do
165
- something you're going to feel agitated
166
- and that's because it was designed to
167
- move you so this is important because if
168
- you want to control stress you need to
169
- learn how to work with that
170
- agitation I'd like to give you a tool at
171
- this point because I think if we go any
172
- further with a lot more science people
173
- are going to uh begin to wonder if this
174
- is just going to be a kind of standard
175
- university lecture sure about the stress
176
- response if you want to reduce the
177
- magnitude of the stress response the
178
- best thing you can do is activate the
179
- other system in the body which is
180
- designed for calming and
181
- relaxation and that system is called the
182
- parasympathetic nervous system and the
183
- parasympathetic nervous system is really
184
- interesting because especially the
185
- cranial nerves the ones that are up in
186
- the brain stem and in the neck area
187
- those have a direct direct line to
188
- various features of your face in
189
- particular the eyes they control things
190
- like eye movements pupil dilation things
191
- of that sort as well as the tongue the
192
- facial muscles Etc so I'm going to teach
193
- you the first tool now so I don't
194
- overwhelm you with all this academic
195
- knowledge without giving you something
196
- useful and the tool that at least to my
197
- knowledge is the fastest and most
198
- thoroughly grounded in physiology and
199
- Neuroscience for calming down in a
200
- self-directed way is What's called the
201
- physiological sigh s g what I'm talking
202
- about when I refer to physiological size
203
- is the very real medical school textbook
204
- relationship between the brain the body
205
- and the body as it relates to the
206
- breathing apparate ey meaning the
207
- diaphragm and lungs and the Heart let's
208
- take the Hallmark of the stress response
209
- the heart starts beating faster blood is
210
- shuttled to the big muscles of the body
211
- to move move you away from whatever it
212
- is this stressor is or just make you
213
- feel like you need to move or talk your
214
- face goes flushed Etc there is however a
215
- way in which you can breathe that
216
- directly controls your heart rate
217
- through the interactions between the
218
- sympathetic and the parasympathetic
219
- nervous system here's how it works when
220
- you inhale so whether or not it's
221
- through the nose or through the mouth
222
- this skeletal muscle that's inside your
223
- body called the diaphragm it moves down
224
- and that's because the lungs expand the
225
- diaphragm moves down your heart actually
226
- gets a little bit bigger in that
227
- expanded space there's more space for
228
- the heart and as a consequence whatever
229
- blood is in there is now at a lower
230
- volume or moving a little bit more
231
- slowly in that larger volume than it was
232
- before you inhaled okay so more space
233
- heart gets bigger blood moves more
234
- slowly and there's a little group of
235
- neurons called the sinoatrial node in
236
- the heart that registers it's pay
237
- believe it or not those neurons pay
238
- attention to the rate of blood flow
239
- through the heart and send a signal up
240
- to the brain that blood is moving more
241
- slowly through the heart the brain then
242
- sends a signal back to the heart to
243
- speed the heart up so what this means is
244
- if you want your heart to beat faster
245
- inhale
246
- longer inhale more
247
- vigorously than your exhales now the
248
- opposite is also true if you want to
249
- slow your heart rate down so stress
250
- response hits you want to slow your
251
- heart rate
252
- down what you want to do is again
253
- capitalize on this relationship between
254
- the body meaning the diaphragm in the
255
- heart and the Brain here's how it works
256
- when you exhale the diaphragm moves up
257
- which makes the heart a little bit
258
- smaller it actually gets a little more
259
- compact blood flows more quickly through
260
- that compact space the sinoatrial node
261
- registers that blood is going more
262
- quickly sends a signal up to the brain
263
- and the parasympathetic nervous system
264
- some neurons in your brain stem send a
265
- signal back to the heart to slow the
266
- heart down so if you want to calm down
267
- quickly you need to make your exhales
268
- longer and or more vigorous than your
269
- inhales now the reason this is so
270
- attractive as a tool for controlling
271
- stress is that it works in real time
272
- this doesn't involve a practice that you
273
- have to go and sit there and do anything
274
- separate from Life the phys ological
275
- sigh is something that people naturally
276
- start doing when they've been crying and
277
- they're trying to recover some air or
278
- calm down when they've been sobbing very
279
- hard or when they are in claustrophobic
280
- environments however the amazing thing
281
- about this thing that we call the
282
- diaphragm the skeletal muscle is that
283
- it's an internal organ that you can
284
- control voluntarily so this incredible
285
- pathway that goes from brain to
286
- diaphragm through What's called the
287
- frenic nerve p h re n i c frenic the
288
- frenic nerve innervates the diap you can
289
- control anytime you want you can double
290
- up your inhales or triple up your
291
- inhales you can exhale more than your
292
- inhales whatever you want to do such an
293
- incredible organ and the physiological
294
- sigh is something that we do
295
- spontaneously but when you're feeling
296
- stressed you can do a double
297
- inhale long exhale now I just told you a
298
- minute ago that if you inhale more than
299
- you exhale you're going to speed the
300
- heart rate up which would promote more
301
- stress and activation now I'm telling
302
- you to do a double inhale exhale in
303
- order to calm down and the reason is the
304
- double inhale exhale which is the
305
- physiological
306
- sigh takes advantage of the fact that
307
- when we do a double inhale even if the
308
- second inhale is sneaking in just a tiny
309
- bit more air because it's kind of hard
310
- to get two deep inhales back to back you
311
- do big deep inhale and then another
312
- little one sneaking it in the little
313
- sacks in your lungs the aoli of the
314
- lungs your lungs aren't just too big
315
- bags but you've got millions of little
316
- sacks throughout the the lungs that
317
- actually make the surface area of your
318
- lungs as big as a tennis court which is
319
- amazing if we were to spread that out
320
- those tend to collapse as we get
321
- stressed and carbon di carbon dioxide
322
- builds up in our bloodstream and that's
323
- one of the reasons we feel agitated as
324
- well but when you do the double inhale
325
- exhale the double inhale reinflates
326
- those little sacks of the lungs and then
327
- when you do the long
328
- exhale that long exhale is now much more
329
- effective at ridding your body and
330
- bloodstream of carbon dioxide which
331
- relaxes you very quickly when you're
332
- feeling stressed the physiological side
333
- done just one to three times so it would
334
- be double inhale exhale double inhale
335
- exhale maybe just two times will bring
336
- down your level of stress very very fast
337
- and as far as I know it's the fastest
338
- way to accomplish that be aware that if
339
- you're going to use the physiological
340
- sigh or exhale emphasize breathing to
341
- calm down that your heart rate will take
342
- about 20 to 30 seconds to come down to
343
- basine and you may need to repeat the
344
- physiological s a few times so let's
345
- think about something now let's think
346
- about stress from not whether or not
347
- it's acute or chronic whether or not
348
- it's good for us or bad for us but on
349
- three different time scales because then
350
- we can arrive at what this is all about
351
- as it relates to emotions but I really
352
- want you to understand the difference
353
- between the three kinds of stress on
354
- three different time scills short-term
355
- medium-term and long-term and what it's
356
- good for and what it's bad for I think
357
- we've all heard that stress is bad for
358
- us we've seen these pictures intended to
359
- frighten us and indeed they are
360
- frightening you see the nice really
361
- plump brain on the left says healthy or
362
- control and then you see the brain that
363
- says stressed above it on the right and
364
- it's like withed or we see that the
365
- hippocampus an area involved in memory
366
- is smaller people that are stressed I
367
- think we've all heard now so many times
368
- that stress is bad but in that
369
- conversation unfortunately it's a lipsed
370
- some of the really positive things that
371
- stress does for us in the short term
372
- when the stress response hits that is
373
- good for your immune system I know that
374
- might be a tough pill to swallow but
375
- it's absolutely true in
376
- fact stress often comes in the form of
377
- bacterial or viral infection and the
378
- stress response is in part organized to
379
- combat bacterial and viral infection so
380
- short-term stress and the release of
381
- adrenaline in particular or epinephrine
382
- same thing adrenaline epinephrine is
383
- good for combating
384
- infection and this to me is just not
385
- discussed enough so that's why I'm
386
- discussing it here and it relates to a
387
- particular tool that many of you ask
388
- about but I don't often get the
389
- opportunity to talk about in such an
390
- appropriate context it's not that it's
391
- ever inappropriate to talk about but
392
- what I'm about to talk about now is the
393
- use of again respiration breathing to
394
- somewhat artificially activate the
395
- stress response and that will accomplish
396
- two things okay I'll return to medium
397
- and long-term stress but I want to say
398
- short-term stress is good because the
399
- dilation of the pupils the changes in
400
- the Optics of the eyes the quickening of
401
- the heart rate the sharpening of your
402
- cognition and in fact that short-term
403
- stress brings certain elements of the
404
- brain online that allow you to focus now
405
- it Narrows your focus you're not good at
406
- seeing the so-called big picture but it
407
- Narrows your focus because it allows you
408
- to do these what I call duration path
409
- outcome types of analysis it allows you
410
- to evaluate your environment evaluate
411
- what you need to do it primes your whole
412
- system for better cognition it primes
413
- your immune system to combat infection
414
- and that all makes sense when you think
415
- about the fact that famine
416
- thirst bacterial infections viral
417
- infections Invaders all of this stuff
418
- liberates a response in the body that's
419
- designed to get you to fight back about
420
- against whatever stressor that happens
421
- to be psychological physical bacterial
422
- viral again the stress response is
423
- generic the
424
- tool takes advantage of the fact that
425
- when adrenaline is released in the body
426
- from the adrenals it has the effect of
427
- also liberating a lot of these killer
428
- cells from the immune organs in
429
- particular from the spleen but from
430
- elsewhere as well and interactions with
431
- the lymphatic system that combat
432
- infection
433
- the way this works in the real world is
434
- best captured by a study that can be
435
- mapped back to so called Wim Hoff
436
- breathing now Wim Hoff breathing is so
437
- named after the so-called Iceman Wim
438
- Hoff there are two components to a sort
439
- of breathing protocol that he
440
- developed that was based also on what's
441
- called Tumo breathing TMO so before whim
442
- there was Tumo breathing and many people
443
- call this now super oxygenation
444
- breathing so it's deliberate
445
- hyperventilation why would somebody want
446
- to do this well deliberate
447
- hyperventilation done for maybe 25
448
- Cycles so inhale exhale inhale exhale
449
- inhale exhale that pattern of breathing
450
- rapid movements of the
451
- diaphragm will liberate adrenaline from
452
- the adrenals when adrenaline is released
453
- in the body you are in a better position
454
- to combat infections and so whether or
455
- not you breathe very quickly in these
456
- cycles of 25 breaths and regardless of
457
- what you call it doesn't matter
458
- adrenaline is released if you take a
459
- cold shower adrenaline is released if
460
- you go into an ice bath deliberately and
461
- even if you do it non- deliberately
462
- adrenaline is released you are mimicking
463
- the stress response and that
464
- adrenaline serves to suppress or combat
465
- incoming infections and this was
466
- beautifully shown in a study that was
467
- published in a very fine journal the
468
- proceedings of the National Academy of
469
- Sciences for the US it's it literally
470
- called proceedings of the naal Academy
471
- USA to distinguish it from other
472
- proceedings of other National academies
473
- in other
474
- countries the way the experiment went is
475
- that people were injected with
476
- endotoxin or in some cases they were
477
- injected with with a bacterial wall that
478
- mimics infection it g it gives you a
479
- fever it makes you feel nauseous it
480
- makes you feel sick it is not pleasant
481
- half of the people did a particular
482
- pattern of breathing that looked very
483
- much like the pattern of breathing I
484
- described a moment ago of doing 25 deep
485
- inhales and exhales followed by an
486
- exhale holding their breath then
487
- repeating 25 inhales exhales holding
488
- their breath so this would look
489
- something like this or if you're
490
- listening it sounds
491
- like 25 30 times you'll start feeling
492
- heated up you'll start feeling the
493
- adrenaline response you're liberating
494
- adrenaline in your body then exhale hold
495
- your breath for 15 seconds and then
496
- repeat now I want to emphasize never
497
- ever ever do this anywhere near water
498
- people have passed out so-called shallow
499
- water bra out people have died please
500
- don't do it at all unless you get
501
- clearance to do it from your doctor
502
- because there are some pulmonary effects
503
- and whatnot and the breath holds should
504
- definitely not be done by anyone that
505
- has glaucoma or pressure uh you know
506
- concerns for the eyes but these
507
- repeated cycles of breathing that
508
- liberate adrenaline allowed the group
509
- that did that protocol to essentially
510
- experience zero symptoms from the
511
- injection of this ecoli which is
512
- remarkable they had much reduced or no
513
- symptoms they didn't feel feverish they
514
- didn't feel sick they weren't vomiting
515
- no diarrhea which is remarkable but
516
- makes total sense when you think about
517
- the fact that the short-term stress
518
- response that what's typically called
519
- the acute stress response is designed to
520
- combat all
521
- stressors many of us are familiar with
522
- the experience of work work work work
523
- work or taking care of a loved one or
524
- stress stress stress stress stress then
525
- we finally relax maybe we even go on
526
- vacation like oh now I'm finally going
527
- to get the break and then we get sick
528
- and that's because the adrenaline
529
- response crashed and your immune system
530
- crashed with it so please understand
531
- this now many of you might say well how
532
- long is it 2 hours is it 3 hours a lot
533
- of you out there that really like
534
- specificity it will vary for everybody I
535
- would just kind of use a rule of thumb
536
- when you are no longer able to achieve
537
- good sleep what good sleep means to you
538
- please see the episodes on sleep if you
539
- want more about tools to sleep when you
540
- are no longer able to achieve good sleep
541
- you are now moving from acute stress to
542
- chronic stress you need to be able to
543
- turn the stress response off okay so now
544
- let's talk about medium-term stress
545
- medium-term stress is going to be stress
546
- that lasts anywhere from several days to
547
- several weeks what is stress threshold
548
- well stress threshold is actually our
549
- ability to cognitively regulate what's
550
- going on in our body a lot of stress
551
- inoculation a lot of managing
552
- medium-term stress on the on the time
553
- scale of weeks or maybe even a couple
554
- months so we're not talking about years
555
- of
556
- stress a lot of that has to do with
557
- raising our stress threshold it's about
558
- capacity and there are very simple tools
559
- excellent tools that will allow us to
560
- modulate our capacity for stress and
561
- they look a lot like the tools I just
562
- described they involve placing oneself
563
- deliberately into a situation where our
564
- adrenaline is increased somewhat not to
565
- the extreme
566
- and then when we are feel flooded with
567
- adrenaline and normally we would Panic
568
- it's about cognitively mentally
569
- emotionally calming ourselves and being
570
- comfortable with that response in our
571
- body and what would this look like you
572
- can use the cyclic hyper oxygenation
573
- breathing to combat infection if you're
574
- feeling kind of run down and there is
575
- also a way in which you can use things
576
- like cold showers or if you exercise and
577
- you bring your heart rate up very high
578
- you kind of go into that high intensity
579
- realm where your heart is beating a
580
- little bit harder than you're
581
- comfortable with the key in those
582
- moments is to learn to relax the mind
583
- while the body is very activated one way
584
- that you can do this and this is kind of
585
- fun if it's approved by your physician
586
- and you're able to do this you can bring
587
- your heart rate up you could do this
588
- through an ice bath if that's your thing
589
- or a cold shower or cyclic oxygenation
590
- breathing or you could Sprint or you
591
- could go hard on the bike whatever is
592
- that brings your heart rate up and then
593
- what you want to do is you want to
594
- actually try and calm the mind while
595
- your body is in this heightened state of
596
- activation when we are stressed our
597
- pupils dilate the effect of that pupil
598
- dilation is to create tunnel vision it
599
- literally Narrows our view of the visual
600
- world we no longer see in Panorama and
601
- there's some other effects as well but
602
- that's because the visual system through
603
- this cranial nerve system that I
604
- described before is Tethered and is part
605
- of this autonomic nervous system
606
- by deliberately dilating your gaze
607
- meaning not moving your head and eyes
608
- around but by deliberately going from
609
- tunnel vision to broader panoramic
610
- Vision literally seeing more of your
611
- environment all at once it creates a
612
- calming effect on the mind because it
613
- releases a particular circuit in the
614
- brain stem that's associated with
615
- alertness AKA stress now this is very
616
- powerful if you're running for instance
617
- and you're at Max Capacity you're close
618
- to it or you're kind of hitting like 80
619
- 90% of maximum on the bike and you
620
- dilate your gaze what you'll find is the
621
- mind can relax while the body is in full
622
- output and this is um relates to work
623
- that in various communities people are
624
- are working with this in the sports
625
- Community military communities Etc but
626
- it's a form not really of stress
627
- inoculation it's more about raising
628
- stress threshold so that the body is
629
- going to continue to be in a high
630
- alertness high reactivity mode high
631
- output but the mind is calm and so this
632
- isn't about you unifying mind and body
633
- this is actually about using body to
634
- bring up your level of activation then
635
- dissociating not the clinical
636
- dissociation kind of disorders but
637
- dissociating the mental or emotional
638
- response from what's going on in your
639
- body and over time so if you do this you
640
- know a couple times you don't have to do
641
- this every workout but if you do this
642
- every maybe once a week or so you start
643
- being comfortable at these higher
644
- activation States what once felt
645
- overwhelming and like a lot of work now
646
- is manageable it feels tolerable so
647
- that's for navigating medium-term stress
648
- and then there's long-term stress now
649
- long-term stress is bad you do not want
650
- adrenaline up in your system for a very
651
- long time in fact you you ideally you
652
- would have your stress go up various
653
- times throughout the day but it would
654
- never stay elevated and it would never
655
- prevent you from getting a good night's
656
- sleep we know that chronic stress
657
- elevated stress and especially in the
658
- so-called type A personalities
659
- creates heart disease leading killer of
660
- for in most every country but in
661
- particular in the US but by no means do
662
- you want to be stressed out all the time
663
- chronically for months and months and
664
- months and years on
665
- end the best tools the best mechanisms
666
- that we know to modulate long-term
667
- stress might surprise you a little
668
- bit first of all there are going to be
669
- the things that don't surprise you which
670
- is everyone knows getting regular
671
- exercise getting good sleep um using
672
- realtime tools to try and Tamp down the
673
- stress response Etc that's all going to
674
- be really
675
- useful the data really point to the fact
676
- that social connection and certain types
677
- of social Connection in particular are
678
- what are going to mitigate or reduce
679
- long-term stress and this is a
680
- particularly important issue nowadays
681
- where we have all these proxies or
682
- surrogates for social connection you
683
- know online and texting with people a
684
- lot everyone has this kind of need to
685
- stay connected to one another humans are
686
- incredibly social creatures the way to
687
- think about social connection and how it
688
- can mitigate some of the long-term
689
- effects of stress is really through the
690
- systems of neuromodulation like
691
- serotonin serotonin again is a
692
- neuromodulator neuromodulators are a
693
- little bit like playist in the brain
694
- they tend to amplify or bias the
695
- likelihood that certain brain circuits
696
- and body circuits are going to be
697
- activated and that others will not
698
- serotonin generally gives us feelings of
699
- well-being at very high levels it makes
700
- us feel blissed and it tends to make us
701
- feel like we have enough in our
702
- immediate environment when we see
703
- somebody that we recognize and Trust
704
- serotonin is released in the brain and
705
- that has certain positive effects on the
706
- immune system and on other systems of
707
- neural repair and and synapses and
708
- things that really reinforce Connections
709
- in the brain and prevent that long-term
710
- withering of connections so serot on is
711
- tied to social connection now social
712
- connection can take many forms some of
713
- those can be romantic attachments those
714
- could be familial attachments that are
715
- non-romantic friendship pets even
716
- attachments to things that just Delight
717
- us having a sense of delight a sense of
718
- really enjoying something that you see
719
- and engage in witness or participate in
720
- that is associated with the serotonin
721
- system and certainly play is one of
722
- those things social connection of
723
- various forms those are things to invest
724
- in I'll be the first to admit social
725
- connection and friendship and
726
- relationships of all kinds to animals or
727
- humans or inanimate objects takes work
728
- it takes investment it takes time in not
729
- needing everything to be exactly the way
730
- you want it to be social connection is
731
- something that we work for but it is
732
- incredibly powerful finding just a few
733
- people even one or an animal or
734
- something that you Delight in believe it
735
- or not has very positive effects on
736
- mitigating this long-term stress on
737
- improving various aspects of our life as
738
- it relates to stress and emotionality
739
- now how do you know if you're making
740
- serotonin you don't know in the moment
741
- but you can learn if you pay attention
742
- to kind of recognize these feelings of
743
- comfort trust Bliss delight and those
744
- are not weak terms those are not
745
- associated just with uh psychological
746
- terms they are they are every bit as
747
- physiological as the movement of your
748
- muscles or the secretion of adrenaline
749
- now there are a plethora of things that
750
- will also impact well-being and allow
751
- you to mod modulate your long-term
752
- stress reduce the likelihood that you'll
753
- engage in long-term stress there are
754
- compounds that are not prescription
755
- compounds that can modulate the stress
756
- system and sometimes because of the way
757
- that life is we just don't have the
758
- opportunity to control life and to
759
- control our response to stress the three
760
- I want to focus on and one that I think
761
- you need to be cautious about that I've
762
- mentioned before include
763
- ashwagandha eleanine and melatonin let's
764
- talk about melatonin first melatonin is
765
- a hormone secreted from the pineal in
766
- direct relationship to how much Darkness
767
- you are in not emotional Darkness but
768
- light suppresses melatonin melatonin
769
- helps you fall asleep it doesn't help
770
- you stay asleep I personally do not
771
- recommend supplementing melatonin
772
- because it's supplemented typically at
773
- very high levels you know 1 to 3
774
- milligrams or even more that is an
775
- outrageous iously high doses also has a
776
- number of potentially negative effects
777
- on the reproductive axis and and
778
- hormones there the other is Aline I've
779
- talked about Aline which provided it's
780
- safe for you can be taken 100 milligrams
781
- or 200 milligrams about a 30 minutes or
782
- 60 minutes before sleep it can enhance
783
- the transition to sleep and depth of
784
- sleep for many people it increases Gaba
785
- this inhibitory neurotransmitter in the
786
- brain it tends to turn off our forbrain
787
- a little bit or reduce the activity of
788
- our kind of thinking systems and
789
- ruminating systems help people fall
790
- asleep but theanine has also been shown
791
- for people that are chronically anxious
792
- or chronically stressed to significantly
793
- increase relaxation it is known to have
794
- a minor effect on anxiety but eight
795
- Studies have shown that it definitely
796
- has a notable effect on stress the other
797
- supplement that can be very useful is
798
- ashwagandha ashwagandha is known to
799
- lower anxiety and cortisol this is great
800
- I mean the opportunity for me anyway to
801
- be able to take something that can help
802
- me reduce my cortisol so that I don't
803
- get some of the long-term effects of
804
- stress and I'm not going to take
805
- ashwaganda year round I would only do
806
- this if I was feeling like I wasn't
807
- managing my short and medium-term stress
808
- well so I don't take it on a regular
809
- basis I do take it when I'm in these
810
- times when things are particularly
811
- stressful so social connection and some
812
- supplementation of course diet exercise
813
- sleep for long-term stress so I hope
814
- today you were able to take a slightly
815
- different view of this thing that we
816
- call stress not just see it as evil but
817
- see it as power powerful and useful in
818
- certain contexts great for us in certain
819
- contexts and problematic in other
820
- contexts and as well to think about the
821
- various tools that I've presented that
822
- can allow you to adjust and modulate
823
- your internal levels of alertness or
824
- calmness so that you can lean more
825
- effectively into life which includes
826
- sleep and social connection and the work
827
- you have to do and of course
828
- acknowledges that the events in the
829
- world are beyond our control what's in
830
- our control is how we react to them
831
- something that's ly said in the wellness
832
- and self-help and psychology world but
833
- for which there often aren't as many
834
- concrete tools that we can really look
835
- to and Trust in real time as always
836
- really appreciate your time and
837
- attention today I hope you practice some
838
- of the tools if they're right for you I
839
- hope you think hard about stress and how
840
- you can control your stress and above
841
- all as always thank you for your
842
- interest in science
843
- [Music]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Data/Data/transcripts/qi4VwpEs3LE_20250113202012.txt DELETED
The diff for this file is too large to render. See raw diff
 
Data/get_video_link.py CHANGED
@@ -4,7 +4,7 @@ from dotenv import load_dotenv
4
  from Data.new_video_added import get_new_video_url
5
  from datetime import datetime
6
  import json
7
-
8
  load_dotenv()
9
 
10
  api_key = os.getenv('API_KEY')
@@ -14,10 +14,11 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
14
  channel = "https://www.youtube.com/@hubermanlab/videos"
15
  new_video_added = False
16
  # video_links_folder_name = os.path.join(BASE_DIR, "videolinks")
17
- print("THIS IS BASE DIR:", BASE_DIR)
18
- print("THIS is current dir:", CURRENT_DIR)
19
- video_links_folder_name = os.path.join(CURRENT_DIR, "videolinks")
20
-
 
21
 
22
  def ensure_directories():
23
  if not os.path.exists(video_links_folder_name):
 
4
  from Data.new_video_added import get_new_video_url
5
  from datetime import datetime
6
  import json
7
+ from pathlib import Path
8
  load_dotenv()
9
 
10
  api_key = os.getenv('API_KEY')
 
14
  channel = "https://www.youtube.com/@hubermanlab/videos"
15
  new_video_added = False
16
  # video_links_folder_name = os.path.join(BASE_DIR, "videolinks")
17
+ PROJECT_ROOT = Path(__file__).resolve().parent.parent
18
+ # print("THIS IS BASE DIR:", BASE_DIR)
19
+ # print("THIS is current dir:", CURRENT_DIR)
20
+ # video_links_folder_name = os.path.join(CURRENT_DIR, "videolinks")
21
+ video_links_folder_name = os.path.join(PROJECT_ROOT, "Data", "video_links")
22
 
23
  def ensure_directories():
24
  if not os.path.exists(video_links_folder_name):
Data/yt_transcript.py CHANGED
@@ -1,53 +1,34 @@
1
  from youtube_transcript_api import YouTubeTranscriptApi
2
- # from get_video_link import video_links_main
3
  from Data.get_video_link import video_links_main
4
- import os
5
- from datetime import datetime
6
- transcripts = []
7
-
8
- import os
9
  from datetime import datetime
10
 
 
 
 
11
 
12
- def save_transcript(video_id, transcript_text, folder_name="Data/transcripts"):
13
  """
14
- Saves transcripts to the local folders
15
- :param video_id:
16
- :param transcript_text:
17
- :param folder_name:
18
- :return:
19
  """
20
- #using abosule path
21
- base_dir = os.path.dirname(os.path.abspath(__file__))
22
- folder_path = os.path.join(base_dir, folder_name)
23
-
24
- if not os.path.exists(folder_path):
25
- os.makedirs(folder_path)
26
 
27
  timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
28
  filename = f"{video_id}_{timestamp}.txt"
29
- filepath = os.path.join(folder_path, filename)
30
-
31
- with open(filepath, "w", encoding="utf-8") as f:
32
- f.write('\n'.join(transcript_text))
33
 
34
- return filepath
 
35
 
36
 
37
  def get_video_id(video_links_list):
38
- video_ids = []
39
- for links in video_links_list:
40
- video_id = links.replace("https://www.youtube.com/watch?v=", "")
41
- video_ids.append(video_id)
42
-
43
- return video_ids
44
 
45
 
46
  def fetch_yt_transcript(video_ids):
47
  """
48
- fetched youtube transcirpts using videoids
49
- :param video_ids:
50
- :return: None
51
  """
52
  video_transcripts = {}
53
 
@@ -61,7 +42,7 @@ def fetch_yt_transcript(video_ids):
61
  file_path = save_transcript(video_id, transcript_text)
62
  video_transcripts[video_id] = {
63
  'text': transcript_text,
64
- 'file_path': file_path
65
  }
66
  print(f"Transcript saved to: {file_path}")
67
 
@@ -77,51 +58,37 @@ def fetch_yt_transcript(video_ids):
77
 
78
  def all_video_transcript_pipeline():
79
  """
80
- Check if there is local folder called transcripts, if not then create one.
81
- if there is then look if new video is added or not
82
- if new video is added then fetch transcripts for the new video and saved it locally.
83
- :return:None
84
  """
85
- CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
86
- transcripts_folder = os.path.join(CURRENT_DIR, "transcripts")
87
-
88
- print(f"Looking for transcripts in: {transcripts_folder}")
89
  video_links_list, new_video_added, new_videos_link = video_links_main()
90
  video_transcripts = {}
91
 
92
  # Always load existing transcripts
93
- if os.path.exists(transcripts_folder):
94
- existing_files = os.listdir(transcripts_folder)
95
- print(f"Found {len(existing_files)} files in transcripts folder")
96
 
97
  for file in existing_files:
98
- if file.endswith('.txt'): # Make sure we only process text files
99
- video_id = file.split("_")[0]
100
- file_path = os.path.join(transcripts_folder, file)
101
- try:
102
- with open(file_path, "r", encoding="utf-8") as f:
103
- transcript_text = f.read().splitlines()
104
- video_transcripts[video_id] = {
105
- 'text': transcript_text,
106
- 'file_path': file_path
107
- }
108
- print(f"Loaded transcript for video: {video_id}")
109
- except Exception as e:
110
- print(f"Error loading transcript {file}: {e}")
111
  else:
112
- print(f"Transcripts folder not found at: {transcripts_folder}")
113
- os.makedirs(transcripts_folder)
114
- print(f"Created transcripts folder at: {transcripts_folder}")
115
 
116
- # Then fetch new transcripts if there are any
117
  if new_video_added and new_videos_link:
118
- print("New videos have been added... Fetching transcripts for new videos")
119
  new_video_ids = [url.split("v=")[1] for url in new_videos_link] # Extract video IDs
120
  new_transcripts = fetch_yt_transcript(new_video_ids)
121
- # Merge new transcripts with existing ones
122
- # video_transcripts.update(new_transcripts)
123
- # print(f"Added {len(new_transcripts)} new transcripts")
124
 
125
  print(f"Total transcripts loaded: {len(video_transcripts)}")
126
 
127
-
 
1
  from youtube_transcript_api import YouTubeTranscriptApi
 
2
  from Data.get_video_link import video_links_main
3
+ from pathlib import Path
 
 
 
 
4
  from datetime import datetime
5
 
6
+ # Dynamically get the root directory of the project
7
+ PROJECT_ROOT = Path(__file__).resolve().parent.parent # Moves up from /Data/
8
+ TRANSCRIPTS_FOLDER = PROJECT_ROOT / "Data" / "transcripts"
9
 
10
+ def save_transcript(video_id, transcript_text):
11
  """
12
+ Saves transcripts to the local folder
 
 
 
 
13
  """
14
+ # Ensure the transcripts folder exists
15
+ TRANSCRIPTS_FOLDER.mkdir(parents=True, exist_ok=True)
 
 
 
 
16
 
17
  timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
18
  filename = f"{video_id}_{timestamp}.txt"
19
+ file_path = TRANSCRIPTS_FOLDER / filename
 
 
 
20
 
21
+ file_path.write_text('\n'.join(transcript_text), encoding="utf-8")
22
+ return file_path
23
 
24
 
25
  def get_video_id(video_links_list):
26
+ return [link.replace("https://www.youtube.com/watch?v=", "") for link in video_links_list]
 
 
 
 
 
27
 
28
 
29
  def fetch_yt_transcript(video_ids):
30
  """
31
+ Fetches YouTube transcripts using video IDs.
 
 
32
  """
33
  video_transcripts = {}
34
 
 
42
  file_path = save_transcript(video_id, transcript_text)
43
  video_transcripts[video_id] = {
44
  'text': transcript_text,
45
+ 'file_path': str(file_path)
46
  }
47
  print(f"Transcript saved to: {file_path}")
48
 
 
58
 
59
  def all_video_transcript_pipeline():
60
  """
61
+ Handles fetching and storing transcripts, checking for new videos.
 
 
 
62
  """
63
+ print(f"Looking for transcripts in: {TRANSCRIPTS_FOLDER}")
 
 
 
64
  video_links_list, new_video_added, new_videos_link = video_links_main()
65
  video_transcripts = {}
66
 
67
  # Always load existing transcripts
68
+ if TRANSCRIPTS_FOLDER.exists():
69
+ existing_files = list(TRANSCRIPTS_FOLDER.glob("*.txt"))
70
+ print(f"Found {len(existing_files)} transcript files.")
71
 
72
  for file in existing_files:
73
+ video_id = file.stem.split("_")[0] # Extract video ID
74
+ try:
75
+ transcript_text = file.read_text(encoding="utf-8").splitlines()
76
+ video_transcripts[video_id] = {
77
+ 'text': transcript_text,
78
+ 'file_path': str(file)
79
+ }
80
+ print(f"Loaded transcript for video: {video_id}")
81
+ except Exception as e:
82
+ print(f"Error loading transcript {file.name}: {e}")
 
 
 
83
  else:
84
+ print(f"Transcripts folder not found at: {TRANSCRIPTS_FOLDER}, creating it.")
85
+ TRANSCRIPTS_FOLDER.mkdir(parents=True, exist_ok=True)
 
86
 
87
+ # Fetch new transcripts if needed
88
  if new_video_added and new_videos_link:
89
+ print("New videos detected... Fetching transcripts.")
90
  new_video_ids = [url.split("v=")[1] for url in new_videos_link] # Extract video IDs
91
  new_transcripts = fetch_yt_transcript(new_video_ids)
 
 
 
92
 
93
  print(f"Total transcripts loaded: {len(video_transcripts)}")
94
 
 
Notebook/__init__.py DELETED
File without changes
ui/app.py CHANGED
@@ -4,8 +4,15 @@ from typing import List, Dict
4
  import sys
5
  from pathlib import Path
6
 
7
- project_root = Path(__file__).parent.parent
8
  sys.path.append(str(project_root))
 
 
 
 
 
 
 
9
  from Rag.rag_pipeline import (
10
  query_database,
11
  generate_response,
 
4
  import sys
5
  from pathlib import Path
6
 
7
+ project_root = Path(__file__).resolve().parent.parent
8
  sys.path.append(str(project_root))
9
+ sys.path.append(str(project_root / "Rag"))
10
+ sys.path.append(str(project_root / "Data"))
11
+ sys.path.append(str(project_root / "Data" / "transcripts"))
12
+ sys.path.append(str(project_root / "Data" / "video_links"))
13
+ sys.path.append(str(project_root / "Llm"))
14
+ sys.path.append(str(project_root / "Prompts"))
15
+ sys.path.append(str(project_root / "utils"))
16
  from Rag.rag_pipeline import (
17
  query_database,
18
  generate_response,